laruence / yaf

Fast php framework written in c, built in php extension
http://pecl.php.net/package/yaf
Other
4.52k stars 1.37k forks source link

关于 route_static 解析问题 #570

Closed yunx-lee closed 2 years ago

yunx-lee commented 2 years ago

有代码如下

$request = new Yaf\Request\Http('/base//user//info///p1////v1////p2/v2/', '/base');
$router = new Yaf\Router();
$router->route($request);
var_dump($request);

现输出结果如下

object(Yaf\Request\Http)#1 (10) {
  ["method"] => string(3) "GET"
  ["module"] => NULL
  ["controller"] => string(4) "User"
  ["action"] => string(4) "info"
  ["uri:protected"] => string(38) "/base//user//info///p1////v1////p2/v2/"
  ["base_uri:protected"] => string(5) "/base"
  ["dispatched:protected"] => bool(false)
  ["routed:protected"] => bool(true)
  ["language:protected"] => string(0) ""
  ["params:protected"] => array(3) {
    ["p1"] => NULL
    ["v1"] => NULL
    ["p2"] => NULL
  }
}

我的疑问是,params 中的 p2 为什么是null? uri 中的 v2 为什么不见了

laruence commented 2 years ago

理论上应该是啥呢? p1 == v1? 如果你不加那么多slash是否正确?

laruence commented 2 years ago

v2丢失的问题修复了, 不过p1///v1是否应该认为是p1->v1,值得商榷