我正在尝试创建上述路线...应将年、月、日和标题传递给该方法。
知道它是如何工作的吗?
提前致谢!
您必须在以下位置创建附加路线application/bootstrap.php
:
Route::set('post', 'post/<year>/<month>/<day>/<title>', array('year'=>'\d{4}', 'month'=>'\d{2}', 'day'=>'\d{2}'))
->defaults(array(
'controller' => 'post',
'action' => 'index',
));
然后在你的控制器中(在这个例子中,Controller_Post),你把这个方法:
public function action_index($year, $month, $day, $title){
//Your code here
}