提交时刷新php脚本
我有一个关于php脚本的问题。我已经创建了一个脚本来编辑一个txt文件,该脚本工作得很好,没有问题。我试图让脚本在提交时自动重新加载,我真的在这里堆叠 以下是脚本:提交时刷新php脚本,php,post,refresh,Php,Post,Refresh,我有一个关于php脚本的问题。我已经创建了一个脚本来编辑一个txt文件,该脚本工作得很好,没有问题。我试图让脚本在提交时自动重新加载,我真的在这里堆叠 以下是脚本: <? if($_POST['Submit']){ $open = fopen("../youtubelink.txt","w+"); $text = $_POST['update']; fwrite($open, $text); fclose($open); $file = file("../youtubelink.txt"
<?
if($_POST['Submit']){
$open = fopen("../youtubelink.txt","w+");
$text = $_POST['update'];
fwrite($open, $text);
fclose($open);
$file = file("../youtubelink.txt");
foreach($file as $text) {
echo $text."<br />";
}
}else{
$file = file("../youtubelink.txt");
echo "<form action=\"".$PHP_SELF."\" method=\"post\">";
echo "<textarea Name=\"update\" cols=\"50\" rows=\"10\">";
foreach($file as $text) {
echo $text;
}
echo "</textarea>";
echo "<input name=\"Submit\" type=\"submit\" value=\"Update\" />\n
</form>";
}
?>
有什么帮助吗?使用Ajax,每x分钟查询一个脚本,检查文本文件的更改。如果Ajax返回“yes,updates available”,则使用Javascript重新加载页面 自动重新加载?你是说页面内容没有实际刷新页面还是其他什么?