0

我阅读数据库以获取$doc_copy(包含链接)。如果有链接,则复制过程开始然后转到mainProcess.php,但如果找不到链接,则转到'summary_index.php';`这是代码:

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';
}

如果没有复制过程就可以了。但是当没有复制过程时 summary_index.php不会运行。怎么了?非常感谢您 :)

4

1 回答 1

0

您的函数没有返回语句,因此$copy总是false

应该是这样的

function copyDoc($link, $savePath){
    return copy($link, $savePath . basename($link));
}
于 2012-10-13T10:57:51.287 回答