$data = file_get_contents($url);
$image = config_item('temp_upload').$image_name;
$file = fopen($image, 'w+');
//fputs($file, $data);
file_put_contents($file, $data, FILE_BINARY);
fclose($file);fputs和file_put_contents不起作用。我用move_uploaded_file创建了一个示例php上传文件,它可以在相同的上传文件夹上工作。
fopen($image,'w+') actually create the image with 0 byte.我试图将上传文件夹更改为0777 nginx:nginx(nginx) apache:apache (Php),没有任何工作。同样的零字节图像。
禁用selinux。还是没用。我在这方面有任何错误。
将move_uploaded_file替换为file_put_contents相同的问题。php.ini中有什么需要更改的地方吗?搜查了却没有得到任何线索。
发布于 2015-05-02 12:55:39
file_put_contents函数的第一个参数需要是一个路径/文件名。你不需要这种功能。
https://stackoverflow.com/questions/30002504
复制相似问题