0

我用于编辑文本文档的 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>

输出

保存后

4

0 回答 0