我想从它的网站(wordpress.org)直接下载到我的ftp主机。我听说有一种方法可以直接做,而不是下载,然后再上传。
我该怎么做呢?使用ftp或php。
编辑:
我没有ssh访问服务器的权限。它是一个免费服务器,位于:FreeWebHostingArea.com。
edit2:
一些网站提供了一种通过php发送fie到目标服务器的方法。但我需要一种方法来下载(而不是发送)文件到我的ftp服务器。
发布于 2013-03-26 14:50:21
经过一番搜索,我找到了如何下载它。以下是代码:
<?php
$new_file = file_get_contents('http://wordpress.org/latest.zip') or exit('unable to open from wordpress');
$current = fopen('latest.zip','c') or exit("Unable to open file!");
fclose($current);
chmod('latest.zip',0777);
file_put_contents('latest.zip',$new_file);
echo 'Done';
?>这个脚本首先打开来自wordpress.org的“wordpress.org”
然后在主机中打开一个名为"latest.zip“的fie。然后关闭它。它应该设置chmod以便写入文件。
最后将下载文件的内容放到主机上"latest.zip“。
重要:上传这个"script.php“的文件夹应该有写访问权,以便创建"latest.zip”文件。
https://stackoverflow.com/questions/15630204
复制相似问题