バックエンド管理者が編集できるように、CKEditorを使用してファイル (契約内容) を書き込もうとしています。
<?php $agreement = file_get_contents('xxxx.txt');?>
<textarea class="ckeditor" cols="80" id="editor1" name="editor1" rows="10">
<?php echo $agreement; ?>
</textarea>
この時点で、#agreement 値が右に戻り、テキストエリア (リッチテキスト エディター) に右の html 要素が表示されます。
私のphpファイル(送信アクション)
if (!empty($_POST))
{
foreach ( $_POST as $key => $value )
{
if ( ( !is_string($value) && !is_numeric($value) ) || !is_string($key) )
continue;
if ( get_magic_quotes_gpc() )
$value = htmlspecialchars( stripslashes((string)$value) );
else
$value = htmlspecialchars( (string)$value );
?>
<tr>
<th style="vertical-align: top"><?php echo htmlspecialchars( (string)$key ); ?></th>
<td><pre class="samples"><?php echo $value; ?></pre></td>
</tr>
<?php
}
}?>
<?php echo $value;
$file = 'xxxx.txt';
// Open the file to get existing content
file_put_contents($file, $value);
?>
行で $value をエコー<h2>Hello Worldwqdwqdqwdqa</h2>
すると、テキスト ファイルに保存/書き込みしたい ( ) 正確なものが返されますが、xxx.txt ファイルはまったく変更されません。私が逃したものは何ですか?