Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/240.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Kohana 3.0中路由处理程序中的参数返回空值_Php_Routes_Kohana 3_Bootstrapping - Fatal编程技术网

Php Kohana 3.0中路由处理程序中的参数返回空值

Php Kohana 3.0中路由处理程序中的参数返回空值,php,routes,kohana-3,bootstrapping,Php,Routes,Kohana 3,Bootstrapping,我目前正在用Kohana 3.0编写一个定制的routeHandler。基本上,我的站点的很大一部分都与特定的项目相关,所以与其有大量的控制器,然后是操作,然后id出现在URL中,我宁愿只有名称。这当然意味着我需要操纵路线 我的引导包含以下内容: Route::set('routeHandler', '(<url>)', array( 'url' => '[a-zA-Z0-9_/-]+', )) ->defaults(array(

我目前正在用Kohana 3.0编写一个定制的routeHandler。基本上,我的站点的很大一部分都与特定的项目相关,所以与其有大量的控制器,然后是操作,然后id出现在URL中,我宁愿只有名称。这当然意味着我需要操纵路线

我的引导包含以下内容:

Route::set('routeHandler', '(<url>)',
    array(
        'url' => '[a-zA-Z0-9_/-]+',
    ))
    ->defaults(array(
            'controller' => 'routeHandler',
            'action'     => 'index',
    ));
当我打印请求时,我得到以下信息:

Request Object 
( 
   [route] => Route Object 
       ( 
           [_uri:protected] => () 
           [_regex:protected] => Array 
               ( 
                   [url] => [a-zA-Z0-9_/-]+ 
               ) 
           [_defaults:protected] => Array 
               ( 
                   [controller] => routeHandler 
                   [action] => index  
               ) 
           [_route_regex:protected] => #^(?:(?P[a-zA-Z0-9_/-]+))?$#uD 
        ) 
   [status] => 200 
   [response] => 
   [headers] => Array 
       ( 
           [Content-Type] => text/html; charset=utf-8 
       ) 
   [directory] => 
   [controller] => routeHandler 
   [action] => index 
   [uri] => 
   [_params:protected] => Array 
       ( 
       ) 
)
我的引导程序中有什么遗漏吗?
我还注意到在引导中设置的某些变量丢失了,比如
base\u url


非常感谢您的帮助。

由于您的路线中提到的参数是
url
,而不是
uri
,请尝试:

$this->request->param('url');

由于路由中提到的参数是
url
,而不是
uri
,请尝试:

$this->request->param('url');