【问题标题】:php with full_special_chars enabled delivers wrong $_GET array启用了 full_special_chars 的 php 提供了错误的 $_GET 数组
【发布时间】:2012-08-04 10:35:36
【问题描述】:

我有以下问题:

这些设置在 php.ini 中

filter.default = full_special_chars
filter.default_flags = 0

如果从服务器请求如下网址:

http://server/action?param1=a&param2=b

$_GET 将包含一个键“amp;param2”。

我怎样才能避免这种情况? (然后禁用上面的设置:))

php 版本:带有 Suhosin-Patch (cli) 的 PHP 5.3.10(构建时间:2012 年 2 月 20 日 22:55:53)

【问题讨论】:

    标签: php filter get


    【解决方案1】:

    使用html_entity_decode()。参考this!!

    $a=htmlentities($_GET['url']); //$a=amp;blah
    
    $b=html_entity_decode($a); //$b=&blah
    

    【讨论】:

    • url 不是参数。上面提到的字符串是在浏览器的地址中输入的。 param2 是实际参数
    • @memical 这只是一个例子。你可以发送你的参数
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-09-17
    • 2014-03-15
    • 2022-01-24
    • 1970-01-01
    • 1970-01-01
    • 2019-02-02
    • 1970-01-01
    相关资源
    最近更新 更多