Nov 9

PHP AJAX demo——操作文本文件

学习
JS代码



AJAX demo——操作文本文件
一个简单的AJAX演示。主要功能有 :

1、读取文本文件并显示。

2、更新文本文件。





Copyright @ 2006 www.phpobject.net!



后台代码operation.php:

header("Cache-Control: no-cache, must-revalidate");
header('Content-type: text/html;charset=utf-8');
if(strip_tags($_GET['action'])=='read')
{
//读取文件
echo nl2br(file_get_contents("demo.txt"));
}else{
//写入文件
$content=$_POST['content'];
file_put_contents('demo.txt',$content);
echo nl2br(file_get_contents("demo.txt"));
}
?>
tags:

to " PHP AJAX demo——操作文本文件 "

Leave a Reply