0
版本1: 我有这个代码的作品,以及:为什么file_get_contents()在没有协议的情况下无法工作?
file_put_contents("../img/avatar/".$id.".jpg", file_get_contents("http://localhost/folder/script.php?id=$id"));
版本2:现在我需要写没有协议的路径file_get_contents
,因此,这里是我的代码的新版本。但它不起作用:
$_GET['id'] = $id;
file_put_contents("../img/avatar/".$id.".jpg", file_get_contents("../folder/script.php"));
版本2有什么问题?
注:script.php
使一个头像。并且版本1也会创建该图像,但版本2只会创建未知图像。
'file_get_contents()'不解释PHP代码,它只是读取文件。它通过'http://'隧道传输的原因是因为你的http服务器解释它,并返回结果。 – Havenard
http://php.net/manual/en/function.error-reporting.php –
@ Fred-ii-没有错误。刚刚保存的照片是未知的。 – stack