每次我尝试更新我的 textarea 并在 textarea 内添加一个引号"
,在我更新后我得到 1 \
,我再次更新我得到 3 个斜杠\\\
,再次是 5 个斜杠,依此类推。尝试在 php ini 中添加 3 个代码以禁用魔术引号,但没有:
magic_quotes_gpc = Off
magic_quotes_runtime = Off
magic_quotes_sybase = Off
还在根文件夹和文件所在的文件夹中添加。还尝试了这个 http://us2.php.net/manual/en/security.magicquotes.disabling.php示例 2 和第一个评论,但仍然没有。
这是我的代码:
PHP
$username=$_SESSION['username'];
$viewtopic = $_GET['viewtopic'];
if ($_POST['edit'] && strip_tags($_POST['topictext'])){
$viewtopic = $_POST['id'];
$topictext=mysql_real_escape_string(strip_tags($_POST['topictext']));
$title=mysql_real_escape_string(strip_tags($_POST['title']));
mysql_query("UPDATE topics SET topictext=".quote_smart($topictext).", title=".quote_smart($title)." WHERE id=".quote_smart($viewtopic)."");
echo "You have updated your topic!";
}
HTML
<textarea name="topictext" rows="2" cols="20" id="main_tbContent" class="TextBox" style="height:128px;width:99%;"><? echo str_replace("\\r\\n","\r\n",$rows['topictext']); ?></textarea><br />