PHP头条
热点:

php实现编辑和保存文件的方法


本文实例讲述了php实现编辑和保存文件的方法。分享给大家供大家参考。具体如下:

save_file.php:

<?php 
session_start(); 
$handle = fopen($_POST['original_file_name'], "w"); 
$text = $_POST['file_contents']; 
if(fwrite($handle, $text) == FALSE){ 
  $_SESSION['error'] = 'There was an error'; 
}else{ 
  $_SESSION['error'] = 'File edited successfully'; 
} 
fclose($handle); 
header("Location: ".$_POST['page']); 
?>

read_file.php:





Untitled Document

希望本文所述对大家的php程序设计有所帮助。

www.phpzy.comtrue/php/54727.htmlTechArticlephp实现编辑和保存文件的方法 本文实例讲述了php实现编辑和保存文件的方法。分享给大家供大家参考。具体如下: save_file.php: There was an error '; }else{ $_SESSION['error'] = ' File edited success...

相关文章

PHP之友评论

今天推荐