所以这就是故事,我对 php 不是很有经验,最近搬到了新主机,我的网站在旧主机上运行良好,但在新主机上,代码有错误。
错误消息说:
Warning: copy() [function.copy]: Unable to access http://i.imgur.com/USlH6p2.jpg in (directory)
这是它说有错误的代码
function upload_image_remote($image, $name) {
$upload_dir = APP_PATH . '/image.uploads';
//check for directory rights
if(!is_writable($upload_dir)) {
echo do_error(_('Folder image.uploads is not writeable'));
exit;
}
//check if there's a directory for today uploads
$today = date("d-m-Y");
if(!is_dir($upload_dir .'/' . $today)) {
if(!mkdir($upload_dir .'/' . $today, 0777)) {
echo do_error(_(sprintf('Folder <strong>image.uploads/%s</strong> could not be created. Please check permissions to be 0777.', $today)));
exit;
}
}
$upload_path = $upload_dir .'/' . $today;
(--> this is where) return copy($image, $upload_path .'/'. $name);
}
我认为这可能是一个权限问题,因为它在(旧主机)000webhost 上完美运行,有人对代码有什么问题有任何想法吗?
谢谢