为什么我的表单在引号前插入反斜杠?

时间:2016-08-03 02:50:24

标签: php html magic-quotes-gpc magic-quotes

我编辑文本文档的PHP代码是在任何地方添加一个反斜杠。或者"使用,我无法弄清楚原因。以前有人遇到过这个吗?你是怎么解决的?

<? 
if($_POST['Submit']){ 
$open = fopen("../content.txt","w+"); 
$text = $_POST['update']; 
fwrite($open, $text); 
fclose($open); 
echo "File updated.<br />";  
echo "File:<br />"; 
$file = file("../content.txt"); 
foreach($file as $text) { 
echo $text."<br />"; 
} 
}else{ 
$file = file("../content.txt"); 
echo "<form action=\"".$PHP_SELF."\" method=\"post\">"; 
echo "<textarea Name=\"update\" cols=\"50\" rows=\"10\">"; 
foreach($file as $text) { 
echo $text; 
}  
echo "</textarea>"; 
echo "<input name=\"Submit\" type=\"submit\" value=\"Update\" />\n 
</form>"; 
} 
?>

所以当我输入例如

<a href="index.php">Home</a>

它保存看起来像这样

<a href=/"index.php/">Home</a>

Output

After save

0 个答案:

没有答案