“在每次报价前削减”问题 [英] "slash before every quote" problem

查看:86
本文介绍了“在每次报价前削减”问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含表单的php页面。



有时候这个页面会被提交给自己(就像上传图片一样)。 b

我不希望用户一次又一次填写每个字段,因此我将其用作表单内的文本输入值:

  value =<?php echo htmlentities(@ $ _ POST ['annonsera_headline'],ENT_COMPAT,'UTF-8');?>> 

这个工作原理除了在每个双引号之前加上\符号...



例如,编写19个轮子会将页面提交给自己:

  19 \wheels 

如果我甚至不使用htmlentities,那么引号后的所有内容消失。



这里有什么问题?



更新:



好的,所以prob是magic_quotes ...这是在我的服务器上启用的...



我应该禁用它吗?我有root权限,它是我的服务器:)

禁用它的危害是什么?

解决方案

看起来像 魔术引号 开启。使用 stripslashes


$ b $

  if(get_magic_quotes_gpc())
{
$ your_text = stripslashes($ your_text);

$ / code>

现在您可以处理 $ your_text

更新:



魔术引号 exaplained here 。对于编写良好的代码,禁用它通常不会造成任何伤害。


I have a php page which contains a form.

Sometimes this page is submitted to itself (like when pics are uploaded).

I wouldn't want users to have to fill in every field again and again, so I use this as a value of a text-input inside the form:

value="<?php echo htmlentities(@$_POST['annonsera_headline'],ENT_COMPAT,'UTF-8');?>">

This works, except it adds a "\" sign before every double-quote...

For instance writing 19" wheels gives after page is submitted to itself:

  19\" wheels

And if I don't even use htmlentities then everything after the quotes dissappears.

What is the problem here?

UPDATE:

Okay, so the prob is magic_quotes... This is enabled on my server...

Should I disable it? I have root access and it is my server :)

Whats the harm in disabling it?

解决方案

Looks like you have magic quotes turned on. Use below condition using stripslashes with whatever text you want to process:

if(get_magic_quotes_gpc())
{
   $your_text = stripslashes($your_text);
}

Now you can process $your_text variable normally.

Update:

Magic quotes are exaplained here. For well written code there is normally no harm in disabling it.

这篇关于“在每次报价前削减”问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆