手册中说 http://serverName/new/5自动路由到 http://serverName/index/news/read/id/5
但是 通过get方式获取id获取不到 ,为啥直接是参数
public function read($id) {
dump($id);
}
这样能获取....
还有 route.php中默认的这个hello怎么用,参数写默认值吗?
return [
'__pattern__' => [
'name' => '\w+',
],
'[hello]' => [
':id' => ['index/hello', ['method' => 'get'], ['id' => '\d+']],
':name' => ['index/hello', ['method' => 'post']],
],
];
这样用????
public function hello($id=0,$name='') {
dump($id);
dump($name);
}
最佳答案