我想打印出錯的原因。PHP:rename()我如何找到錯誤原因?
error_get_last()似乎沒有返回任何東西。 rename()返回TRUE | FALSE而不是異常。
if (!rename($file->filepath, $full_path)) {
$error = error_get_last();
watchdog('name', "Failed to move the uploaded file from %source to %dest", array('%source' => $file->filepath, '%dest' => $full_path));
}
你想解決一個錯誤,或者你想這是你的最終計劃的功能嗎?如果這是一個錯誤重命名發出E_WARNING,你可以閱讀,如果你設置error_reporting顯示E_NOTICE。如果這是爲了生產,你應該添加一些文件檢查,如剛剛發佈的建議 – 2012-07-06 10:37:42