[英]How to move a php file from server to server
我正在做一个Wordpress插件,一旦您激活了插件,我想将一些模板从外部存储库(服务器)复制到当前wordpress实例中的downloads文件夹。
到目前为止,我已经完成了这个工作,但是问题是尝试在其中执行php代码功能,我得到了这个错误日志:
[2014年9月26日00:11:47美国/芝加哥] PHP致命错误:在第21行的/home/german/public_html/wp-content/uploads/template/squeeze-land.php中调用未定义的函数get_the_title()
所以正在尝试执行get_the_titel()
函数
我想将文件移到另一台服务器的目标文件夹中。 谢谢。
function getTemplates(){
$url = 'http://domain.com/wp-content/uploads/template/squeeze-land.php';
$newFile = $_SERVER['DOCUMENT_ROOT'].'/wp-content/uploads/template/testing.php';
set_time_limit(0); //Unlimited max execution time
$path = $newFile;
$url = $url;
$newfname = $path;
echo 'Starting Download!<br>';
$file = fopen ($url, "rb");
if($file) {
$newf = fopen ($newfname, "wb");
if($newf)
while(!feof($file)) {
fwrite($newf, fread($file, 1024 * 8 ), 1024 * 8 );
echo '1 MB File Chunk Written!<br>';
}
}
if($file) {
fclose($file);
}
if($newf) {
fclose($newf);
}
echo 'Finished!';
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.