php 输入过滤,获取和发布参数中不需要的斜线

php 输入过滤,获取和发布参数中不需要的斜线

我如何禁用输入过滤?

以下是一个例子:

echo "\$_GET: ";
var_dump($_GET);

echo "filter.default: ";
var_dump(ini_get('filter.default'));
echo "filter.default_flags: ";
var_dump(ini_get('filter.default_flags'));

echo "\nCurrent PHP version: " . phpversion() . "\n";

当我用这个 url 测试它时:http://example.org/?text=<a href="http://example.org">...</a>代码生成如下:

$_GET: array(1) {
  ["text"]=>
  string(38) "<a href=\"http://example.org\">...</a>"
}
filter.default: string(1) "0"
filter.default_flags: bool(false)

Current PHP version: 5.2.10-2ubuntu6.7

服务器信息:

System  Linux magentob.builder.hu 2.6.31-14-server #48-Ubuntu SMP Fri Oct 16 15:07:34 UTC 2009 x86_64 
This server is protected with the Suhosin Patch 0.9.7
This program makes use of the Zend Scripting Language Engine: Zend Engine v2.2.0
Loaded Modules:     core mod_log_config mod_logio prefork http_core mod_so mod_alias mod_auth_basic mod_authn_file mod_authz_default mod_authz_groupfile mod_authz_host mod_authz_user mod_cgi mod_deflate mod_dir mod_env mod_expires mod_mime mod_negotiation mod_php5 mod_rewrite mod_setenvif mod_ssl mod_status mod_vhost_alias 

答案1

您想要禁用magic_quotes的功能在 php 5.3.0 中默认为禁用,在 php 5.4.0 中被删除

http://www.php.net/manual/en/info.configuration.php#ini.magic-quotes-gpc

编辑:禁用指南http://www.ecommerceoffice.com/enabling-disabling-magic-quotes-in-php/

相关内容