本文实例讲述了PHP实现编辑和保存文件的方法。分享给大家供大家参考。具体如下:
save_file.PHP:
PHP;">
PHP
session_start();
$handle = fopen($_POST['original_file_name'],"w");
$text = $_POST['file_contents'];
if(fwrite($handle,$text) == FALSE){
$_SESSION['error'] = '';
}else{
$_SESSION['error'] = '';
}
fclose($handle);
header("Location: ".$_POST['page']);
?>
read_file.PHP:
PHP;">
Untitled Document