dongshu7162 2012-10-13 10:25
浏览 10

too long

I read database to get $doc_copy (contain links). If there's link, so copy process start and then go to mainProcess.php, but if not found link, then go to 'summary_index.php';` here's the code :

function copyDoc($link, $savePath){
    @copy($link, $savePath . basename($link));
}

while ($row = mysql_fetch_array($q)){   
    $doc_copy = $row['doc_url'];
    $copy = copyDoc($doc_copy, $savePath);
     if ($copy=== false){
        include 'summary_index.php';
    }
    else include 'mainProcess.php';
}

it's ok if there's no copy process. but when there's no copy process summary_index.php doesn't run. what' wrong? thank you very much :)

  • 写回答

1条回答 默认 最新

  • dongwei1263 2012-10-13 10:57
    关注

    Your function does not have a return statement therefore $copy would always be false

    It should be like this

    function copyDoc($link, $savePath){
        return copy($link, $savePath . basename($link));
    }
    
    评论

报告相同问题?