1
对于CakePHP的路由传递参数CakePHP的路由问题,据我所知,如果你做从URL
Router::connect(
'/:controller/:id',
array('action' => 'view'),
array('id' => '[0-9]+')
);
这将映射到是http://www.mywebsite.com/controller/view/id任何网址,
但如何映射URL是http://www.mywebsite.com/controller/id/action ?
对于前:http://www.mywebsite.com/classes/3/create/2
,在我创建的类控制器功能,
它将接收参数的$ id,这是3在这种情况下,和$算,也就是2在这种情况下,
public function create($id, $count) {
....
// i can here create a total number of $count students
// and assign them class_id $id
// so student1.class_id = 3
// and student2.class_id = 3
}
我试过,
Router::connect(
'/:controller/:id/:action',
array('id' => '[0-9]+'),
array('count' => '[0-9]{,2}')
);
它没有活像k对我来说。
我获取价值是这样的/ Android的ATC培训认证课程。主URL后面。那么我怎么能做到这一点......? – GYaN 2017-07-10 06:09:37