简体   繁体   English

PHP中奇怪的文本添加

[英]Weird text addition in PHP

I have a form posting data to a php page. 我有一个将数据发布到php页面的表单。 Then I have the PHP page echoing the data aswell as posting it to twitter. 然后,我在PHP页面上回显数据并将其发布到Twitter。 Whenever In a word with an apostrophe it adds a back-slash right before it. 只要在带撇号的单词中,它前面都会加一个反斜杠。 So I type in "I'm going to the park" it echos "I\\'m going to the park" what's going on and how do I fix it? 因此,我键入“我要去公园”,它回显“我要去公园”,这是怎么回事,如何解决? Thanx :) 谢谢:)

This is caused by magic_quotes , a configuration option you should turn off. 这是由magic_quotes引起的,应该将其关闭。 See here for good explanations. 请参阅此处以获得良好的解释。

you can turn it off in the php.ini or .htaccess 您可以在php.ini或.htaccess中将其关闭

or just get rid in place: 或就地摆脱:

if (get_magic_quotes_gpc()) foreach($_POST as $k=>$v) $_POST['$k'] = stripslashes($v);

在提交内容之前,在内容周围添加stripslashes()

magic_quotes_gpc is on.. i'd turn it off in your php.ini or server settings panel (depending on your host) magic_quotes_gpc已打开。我会在您的php.ini或服务器设置面板中将其关闭(取决于主机)

edited to the, although somewhat painful, support of Col. Shrapnel.. 编辑,虽然有些痛苦,但支持上校弹片。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM