-1

我收到此错误

(!)警告:file_get_contents(wp-content/uploads/2013/06/wpid-Mt-ZionlaunchA4poster.jpg<br>)[function.file-get-contents]:打开流失败:HTTP请求失败!HTTP/1.1 404 Not Found in C:\wamp\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);
}

如您所见,我添加了 echo 以查看发生了什么

这是输出

截屏

4

1 回答 1

1

的来源是什么$imgf。如果是POST / GET数据,那么您需要<br>POST/GET请求页面中删除。

如果你想删除<br>usingPHP你可以这样做:

$imgr = str_replace('<br>', '', $imgr);
于 2013-07-07T12:56:10.890 回答