Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有登录功能,将检查会话,如果它不存在,用户将通过重定向Request::instance()->redirect('managers/error/1');
Request::instance()->redirect('managers/error/1');
在管理器控制器的错误操作中,我无法获得表示特定错误消息的值 1。如何从 url 中捕获值“1”,我只使用标准路由。
根据你的路线,你可以做
public function action_error($id) { // $id will be your 1 }
或者您可以明确设置路线
Route::set('managers_errors', 'managers/error/<id>', array('id' => '\d+'));
然后你可以在方法/动作中使用
$id = $this->request->param('id');