TP5里面的url_param_type按名称成对解析urlquery参数:
比如:
// 原url网址http://www.tp5.com/index.php/index/index/t/a/1/b/2,获取pathinfo后为/index/index/t/a/1/b/2,再把分隔符转为'|',explode('/')转为数组,使用array_shift取出module、controller、action后再使用preg_replace_callback获取键值对
$url = 'a|1|b|2';
$var = [];
preg_replace_callback('/(\w+)\|([^\|]+)/', function ($match) use (&$var) {
$var[$match[1]] = strip_tags($match[2]);
}, $url);
//$var的结果为Array ( [a] => 1 [b] => 2 )