Php 正在编写部分HTML格式的文本

Php 正在编写部分HTML格式的文本,php,html,file,text,fwrite,Php,Html,File,Text,Fwrite,我有一个有趣的问题。我有下面的代码,它接受$\u POST['content']和$\u POST['page']。我试图编写的“内容”是“HTML”(见下文),但是,实际编写的内容是 <footer> <div class="grid_16"> <div class="wrapper"> <span class="right"><!-- {

我有一个有趣的问题。我有下面的代码,它接受
$\u POST['content']
$\u POST['page']
。我试图编写的“内容”是“HTML”(见下文),但是,实际编写的内容是

<footer> 
        <div class="grid_16"> 
                <div class="wrapper"> 
                        <span class="right"><!-- {%FOOTER_LINK} --></span>

截断HTML的原因可能是因为$\u POST变量中存在未编码的和

2.2. Reserved Characters

   Many URI include components consisting of or delimited by, certain
   special characters.  These characters are called "reserved", since
   their usage within the URI component is limited to their reserved
   purpose.  If the data for a URI component would conflict with the
   reserved purpose, then the conflicting data must be escaped before
   forming the URI.

      reserved    = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
                    "$" | ","

   The "reserved" syntax class above refers to those characters that are
   allowed within a URI, but which may not be allowed within a
   particular component of the generic URI syntax; they are used as
   delimiters of the components described in Section 3.

我稍微编辑了一下你的帖子,以避免可能出现的混乱。如果你发现它改变了你的意图,请重新编辑。另外,尝试
print\r($\u POST)
查看您的PHP是否真的得到了您认为发布的内容。谢谢-更改很好。我已经检查了$_POST['content']是否完整和正确。我猜某个地方正在播放一些编码,但我不能把我的手指放在它上面。感谢polywhirl-newdoc语法没有太大帮助,因为内容来自HTML表单。因此就有了$u POST['content']。。。很抱歉,您的原始帖子有
$\u post['content']=…
。好的,进度…似乎我必须在将HTML写入文件urlencode($content)之前对其进行URL编码。问题是为什么?确实如此。尝试包括例如@copy;将违反RFC2396。我假设通过使用urlencode()将这些替换为符合要求的%XX。
<footer> 
    <div class="grid_16"> 
        <div class="wrapper"> 
            <span class="right"><!-- {%FOOTER_LINK} --></span> l
            la-panacee &copy; 2013 &nbsp;|&nbsp; 
            <a href="privacyStatement.php">Privacy policy</a>
        </div> 
    </div>
 </footer>
2.2. Reserved Characters

   Many URI include components consisting of or delimited by, certain
   special characters.  These characters are called "reserved", since
   their usage within the URI component is limited to their reserved
   purpose.  If the data for a URI component would conflict with the
   reserved purpose, then the conflicting data must be escaped before
   forming the URI.

      reserved    = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
                    "$" | ","

   The "reserved" syntax class above refers to those characters that are
   allowed within a URI, but which may not be allowed within a
   particular component of the generic URI syntax; they are used as
   delimiters of the components described in Section 3.