2011-12-29 57 views

回答

2

可以使用file_get_contents閱讀HTML文件的內容:

$html = 'example.html'; 
$currentContents = file_get_contents($html); 

// set the textarea text to $currentContents 

要編寫的變化,你將不得不張貼textarea的PHP腳本(通過HTML表單),然後像做:

$newContents = $_POST['textareaName']; 
$html = 'example.html'; 
$fh = fopen($html, 'w') or die("File could not be opened."); 
fwrite($fh, $newContents); 
fclose($fh); 

您需要擔心一些安全問題,但這是如何實現您的目標的基本示例。祝你好運!

http://us.php.net/file_get_contents

http://us.php.net/fwrite

相關問題