1

我的代码工作正常,但不保留来自服务器的文件时间/修改日期......我在 curl 中添加了文件时间选项,但写入文件仍然会在保存文件时写入文件(当前日期)有什么建议吗?我有视力障碍,所以如果我犯了错误对不起,提前谢谢你。

$filename = "image.jpg" $imgurl = " http://www.example.com/image.jpg "

$ch = curl_init(); 
curl_setopt ($ch, CURLOPT_URL, $imgurl); 
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); 
// Getting binary data 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1); 
curl_setopt($ch, CURLOPT_FILETIME, TRUE);
$image = curl_exec($ch); 
curl_close($ch); 

file_put_contents($filename, $image);
4

0 回答 0