Stackoverflow를 검색하여 비슷한 문제를 발견했지만 답변을 이해할 수 없습니다. 나는 2 일 전에 PHP 만 배웠으므로 나 한테 쉽게 들려주세요.
제 문제는 사용자가 파일에 텍스트를 작성하고 제출하기 위해 양식을 사용하고 있다는 것입니다. 그들이 제출을 명중 할 때 원본은 파일로 쓰여지고 다음에 그들이 양식을 방문 할 때 텍스트는 그들이 수정할 수있는 형태로 남아 있습니다. 문제는 인용 형식을 입력하고 제출하면 앞에 \가 추가된다는 것입니다.
예 : 사용자가 글을 참고하세요 : "안녕하세요" 사용자 안타 양식 다시로드를 입력하고 "안녕하세요"\ 나 \ 물건을 취소 알고
을 \ "안녕하세요"와 같은 따옴표가 수 등으로 출력된다 문자열로 출력 될 수 있지만 $ _POST를 사용하여 양식 데이터를 저장할 수 있으며 인용문을 사용할 때마다 \를 사용할 수 있습니까?
PHP로 초보자로서 자세하게 설명해주십시오. 미리 감사드립니다. 여기 내 문제를 일으키는 코드입니다 :
echo '<div class="wrap">';
// makes an if statement to check if the submit button has been pushed
if (isset($_POST['Submit1'])) {
// opens the include file and writes the contents of "left-form" to the file. left-form is the name of the html text area
$file = fopen($_SERVER['DOCUMENT_ROOT'] . '/wp-content/themes/mytheme/options/index_left.php', "w");
fwrite($file,$_POST["left_form"]);
fclose($file);
}
echo '<p><form method="POST" action=""><textarea rows="4" cols="50" name="left_form">';
// includes the contents of the file being written to as the text inside the text field
include $_SERVER['DOCUMENT_ROOT'] . '/wp-content/themes/mytheme/options/index_left.php';
echo '</textarea></p>';
echo '<input type="submit" value="Submit" name="Submit1"></form>';
// sets an if statement to check if the post button has been hit to display a message that it has been posted
if (isset($_POST['Submit1'])) {
echo htmlspecialchars($_POST["left_form"]) . '</br>HAS BEEN POSTED';
}
echo '</div>';
}
'var_dump (get_magic_quotes_gpc());'출력은 무엇입니까? –
코드 상단에 이것을 써 봤지만 아무런 차이가 없었지만 텍스트 필드 위에 int (0)을 쓰도록했습니다. – user2946010
그러면 사용할 수 없습니다. –