CKEditor을 사용하여 파일 (계약 내용)을 작성하려고 했으므로 백엔드 관리자가 편집 할 수 있습니다. 이 시점에서 php - file_put_contents does not work
<?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);
?>
보여줍니다
줄에 내가 에코 ed $ 값, 내 텍스트 파일에 저장/쓰기 (<h2>Hello Worldwqdwqdqwdqa</h2>
) 정확히 하지만 xxx.txt 파일을 전혀 변경하지 않는 원하는 것을 반환합니다. 내가 놓친 것은 무엇입니까?
당신은 당신의 오류 로그 안에 봤어? –
\ xampp \ apache \ logs \ error.log? 아무 변화도, 마지막 것은 2 일 전에, –
당신의 파일에 chmod 0666 그래서 아파치는 그것을 쓸 수 있는가? – Twisted1919