我有一个文件叫filecontent.txt其中包括一些PHP代码。如何用文件内容替换网页文件内容?
,我已经叫的index.php另一个文件,
我想更换的的index.php内容与filecontent.txt内容。
有没有解决方案?
请帮我解决这个问题。
我有一个文件叫filecontent.txt其中包括一些PHP代码。如何用文件内容替换网页文件内容?
,我已经叫的index.php另一个文件,
我想更换的的index.php内容与filecontent.txt内容。
有没有解决方案?
请帮我解决这个问题。
您可以使用PHP的复制功能
如:
<?php
$file = 'example.txt';
$newfile = 'example.txt.bak';
if (!copy($file, $newfile)) {
echo "failed to copy $file...\n";
}
?>
unlink ("index.php");
rename ("filecontent.txt", "index.php");
它没有按照我的预期工作。 –
结果是什么,什么是例外? – nidhin
对不起,回复迟了, 它现在正在工作.. –