Php _getParam(';paramName';)编码问题

Php _getParam(';paramName';)编码问题,php,zend-framework,utf-8,Php,Zend Framework,Utf 8,我的php应用程序尝试从点击它的url获取描述参数:例如 http://example.co.uk/events/errnc8/promo.html?description=Leicester%27s+finest+to+close+this+year%27s+Glastonbury& 但是当我打电话的时候 $description = $this->_getParam('description'); 我最终将$description设置为 Leicester&

我的php应用程序尝试从点击它的url获取描述参数:例如

http://example.co.uk/events/errnc8/promo.html?description=Leicester%27s+finest+to+close+this+year%27s+Glastonbury&
但是当我打电话的时候

$description = $this->_getParam('description');
我最终将$description设置为

Leicester's finest to close this year's Glastonbury
正确编码/解码此参数的最佳方法是什么?

请检查

您应该使用这个标准化函数来充分利用php自己的库

string htmlspecialchars_decode ( string $string [, int $flags = ENT_COMPAT | ENT_HTML401 ] )

$description=html\u entity\u decode($this->\u getParam('description'),ENT\u引号,'UTF-8')


这将解码html实体,但如果您打算在不进行任何清理的情况下仅回显该值(除非_getParam()方法清理输入),这看起来像是一个巨大的XSS安全漏洞。

这对我来说很有效:感谢您提出了安全问题,我将与比我更了解的人一起提出:)