我有简单的CI(CodeIgniter)代码。我想要做的是:当我进入图片路径textarea的,PHP下载每张图片到我的服务器,并给他们的文件名,但我有这些错误:file_get_contents给我失败打开流
Message: file_get_contents(http://geosmiley.ge/Upload/Product/42/1.jpg) [function.file-get-contents]: failed to open stream: Invalid argument
Message: file_get_contents(http://geosmiley.ge/Upload/Product/42/2.jpg) [function.file-get-contents]: failed to open stream: Invalid argument
这里是我的CI代码:
$image = explode("\n", $_POST['images']);
for ($i = 0; $i < count($image); $i++){
if (substr($image[$i], 0, strlen($this->host) - 1) != $this->host){
file_put_contents('images/'.$title_url.'_'.$i.'.jpg', file_get_contents($image[$i]));
$image[$i] = $this->host.'/images/'.$title_url.'_'.$i.'.jpg';
}
}
$poster = $image[0];
$images = implode("\n", $image);
它能做什么是简单的下载最后文件,并为第一和第二文件给我的错误
请不要给我其他方面的建议喜欢使用的卷曲FOPEN。我认为这是正确的方式,因为PHP成功下载LAST FILE。请帮我解决我的问题
是 “allow_fopen_url” 开启? http://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen – 2012-01-13 21:16:02
“Tandu”我不会允许fopen,出于安全目的 – Irakli 2012-01-13 21:20:01
那么你不能使用' file_get_contents'。它还要求打开设置。 – 2012-01-13 21:25:47