在PHP中,如何在类中使用urldecode()。我有以下课程
class exam
{
function __constract()
{
$this->get = $_GET;
//decode the url
array_walk_recursive($this->get, array($this, 'urldecode'));
}
}因为它显示了错误
警告: array_walk_recursive()期望参数2是一个有效的回调,类‘does’在第7行没有一个方法'urldecode‘
发布于 2020-06-08 20:01:36
您正在传递当前对象$this和方法名urldecode,因此它正在查找$this->urldecode()。只需传递内置函数的名称:
array_walk_recursive($this->get, 'urldecode');但是,$_GET变量已经解码。来自urldecode()
警告超级球体
$_GET和$_REQUEST已经解码。对urldecode()在$_GET或$_REQUEST中的元素上使用可能会产生意外和危险的结果。
https://stackoverflow.com/questions/62270120
复制相似问题