-1
我得到這個錯誤PHP的file_get_contents添加到未知的URL
警告(!): 的file_get_contents(的wp-content /上傳/ 2013/06/wpid-MT-ZionlaunchA4poster.jpg <BR>) [function.file-get-contents]: 無法打開流:HTTP請求失敗! HTTP/1.1 404 C未實測值:\瓦帕\ WWW \ progjet \ 3 \ post.php中上線55
正如你可以看到,有在文件名的末尾<br>
標籤。
這裏是我的代碼:
foreach($imgf as $imgr){
echo $imgr;
$upimg[] = get_img(trim($imgr));
}
function get_img($url){
file_put_contents(basename($url),file_get_contents($url));
$path = 'http://'. $_SERVER['SERVER_NAME'] . dirname($_SERVER['REQUEST_URI']);
return $path.'/'. basename($url);
}
,你可以看到我添加回聲看看是怎麼回事
這裏是出把
嘗試'用strip_tags($網址)' – Swissdude
你有'$ imgr'(和'$ imgf')的問題不''file_get_contents()'。 'echo htmlentities($ imgr);'應該顯示真實的'$ imgr'內容。 – furas