我想将一个zip文件从外部服务器复制到脚本运行的目录。
例如:
$thezipfile = "http://www.yxz.com/user/login/userid/1234/password/1234/page/L2V4cG9ydC9kb3dubG9hZC90L01RPT0vYy9NZz09Lw=";
这不起作用(download.php):
$save = file_put_contents('newfile.zip',$thezipfile);
之后,我的服务器上有一个名为'newfile.zip'的文件,但是......它是空的!??
答案 0 :(得分:1)
您没有要将任何文件内容放入新文件中。
在file_get_contents($thezipfile)
file_put_contents()
答案 1 :(得分:1)
您需要在保存之前实际读取外部文件。将第二行更改为
file_put_contents('newfile.zip',file_get_contents($thezipfile));