开发者

Kohana: why won't this route generate fully?

开发者 https://www.devze.com 2023-02-12 07:35 出处:网络
I have the following route in my bootstrap: Route::set(\'cycleadmin\', \'(<lang>/)cycleadmin(/<model>(/<action>(/<id>)))\', array(

I have the following route in my bootstrap:

Route::set('cycleadmin', '(<lang>/)cycleadmin(/<model>(/<action>(/<id>)))', array(
    'lang' => $lang_options,
    'model' => '[a-z_]{0,}',
    'action' => '[a-z_]+',
    开发者_Python百科'id' => '\d+',
))->defaults(array(
    'controller' => 'cycleadmin',
    'lang' => DEFAULT_LANG,
    'model' => 'cycle',
    'action' => NULL,
));

Then I have the following uri request to generate the route:

echo Route::get('cycleadmin')->uri(array('action' => 'add'));

But this ends up only returning: /cycleadmin

I'm using Kohana 3.1 (v3.1.1.1). This worked perfectly in Kohana 3.0.9.

What am I missing?


Try to also set <model> . Does it work?

Regards

Sorin


As of 3.1, the route::get()-method doesn't fill in the defaults - you have to manually specify every parameter. Don't ask me why, but it is intended behaviour (source: the official forums).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号