如何使Kohana的路由更像Zend Framework

时间:2022-10-10 18:10:14

Assuming this URL:

假设这个网址:

http://example.com/param1/value1/param2/value2

http://example.com/param1/value1/param2/value2

In the Zend Framework, by default I can easily retrieve the parameters of such as URL using $this->request->param("param1"), $this->request->param("param2"), etc.

在Zend Framework中,默认情况下,我可以使用$ this-> request-> param(“param1”),$ this-> request-> param(“param2”)等轻松检索URL等参数。

However, in Kohana (3.1.2), by default there can be only one parameter (an ID) and everything else as to be manually setup in the bootstrap's routing.

但是,在Kohana(3.1.2)中,默认情况下只能有一个参数(一个ID),而其他所有内容都要在bootstrap的路由中手动设置。

So is there a way to make Kohana behave more like the Zend Framework? Perhaps is there some route I could set that will make it work like Zend?

那么有没有办法让Kohana表现得更像Zend Framework?或许有一些我可以设置的路线会让它像Zend一样工作吗?

1 个解决方案

#1


0  

If you need a variable number of parameters, you need to add overflow handler http://www.dealtaker.com/blog/2010/03/03/kohana-php-3-0-ko3-tutorial-part-6/

如果需要可变数量的参数,则需要添加溢出处理程序http://www.dealtaker.com/blog/2010/03/03/kohana-php-3-0-ko3-tutorial-part-6/

It will capture everything after provided parameters as a string. You just split it by slashes to get the rest of options.

在将参数提供为字符串后,它将捕获所有内容。你只需用斜杠拆分它就可以得到其余的选项。

#1


0  

If you need a variable number of parameters, you need to add overflow handler http://www.dealtaker.com/blog/2010/03/03/kohana-php-3-0-ko3-tutorial-part-6/

如果需要可变数量的参数,则需要添加溢出处理程序http://www.dealtaker.com/blog/2010/03/03/kohana-php-3-0-ko3-tutorial-part-6/

It will capture everything after provided parameters as a string. You just split it by slashes to get the rest of options.

在将参数提供为字符串后,它将捕获所有内容。你只需用斜杠拆分它就可以得到其余的选项。