0

我正在阅读一个 rss 提要并获得一个图像 url,现在我想将此图像存储在我的文件夹中。为此,我正在使用

$image=$movies->channel->item[i]->medium_image_url;

当我

echo $image

它显示 http://showmycode.co.in/supermob/app/webroot/img/uploads/product_images/medium/0a646_Bombay-Biryani1.jpg

然后我把我$url

$url = '$image';

$img = 'images/'.time().'.'.'jpg';
file_put_contents($img, file_get_contents($url));

和我

echo $url its show  only $image;

我发现了一个错误

警告:file_get_contents($image) [function.file-get-contents]:无法打开流:
               第 36 行的 D:\wamp\www\test_om\rss\rssfeed.php 中没有这样的文件或目录

如何存储此图像?

4

1 回答 1

3

我认为错误在这里:

$url = '$image';

删除引号并尝试以下操作:

$url = $image;
于 2011-11-04T05:11:57.290 回答