【发布时间】:2012-09-16 19:11:33
【问题描述】:
这是我的 php 代码,它只获取 9 个图像中的第一个图像,尽管当我手动检查 URL 时,所有 9 个图像 URL 都正确形成,我也用 CURL 尝试了此代码,但循环不起作用,请告诉我我做错了什么?
<?php
for($i=2 ; $i <= 10 ; $i++ ){
header('Content-type: image/jpeg;');
$url = "http://www.lafourchette.com/p-3.3.0/default/rate-bar-bg-".$i.".jpg";
$mycontent = file_get_contents($url);
echo $mycontent;
}
【问题讨论】:
标签: php loops header logic file-get-contents