textarea post 值被 url 中的 &= 截断
我有一个文本区域,它将其值提交到 onkeypress 的 php 页面。问题是,如果您在文本区域中输入这样的网址:
http://website.com/index.php?value=1&othervalue=2
接收文本区域数据的 php 页面会将 &othervalue=2 解释为文本区域的截止点,就好像 othervalue=2 是另一个后置变量一样收到。如果这没有意义,我会尝试以不同的方式解释它。有什么想法可以解决这个问题吗???
I have a textarea that submits its value to a php page onkeypress. the problem is, if you type a url like so into the textarea:
http://website.com/index.php?value=1&othervalue=2
the php page receiving the textarea data interprets &othervalue=2 to be the cutoff point for the text area as if othervalue=2 was another post variable it is supposed to receive. If this doesn't make sense I will try to explain it differently. Any ideas to get around this?????
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
value
应该等于1&othervalue=2
,则需要urlencode
与符号,结果为1%26othervalue%3D2
。value
is supposed to equal1&othervalue=2
, you need tourlencode
the ampersand, resulting in1%26othervalue%3D2
.我假设您正在使用 ajax (因为您正在使用 onkeypress),请确保您始终正确转义数据。请参阅 encodeURIComponent
I assume you're using ajax (since you're using onkeypress), make sure you always escape your data properly. See encodeURIComponent