Home > Backend Development > PHP Tutorial > 关于laravel中路由跳转控制器的问题

关于laravel中路由跳转控制器的问题

WBOY
Release: 2016-06-06 20:19:02
Original
2321 people have browsed it

我现在有这样类型的链接:
http://www.xxx.com/api/signup

其中api是控制器ApiController

需要变换的是signup,有可能是signin,create,del,move等

请问在路由里面怎么写,才能让后面的值对应到指定的控制器中的方法

也就是访问http://www.xxx.com/api/signup对应到api控制器下的signup方法,同理signin,create,del,move

回复内容:

我现在有这样类型的链接:
http://www.xxx.com/api/signup

其中api是控制器ApiController

需要变换的是signup,有可能是signin,create,del,move等

请问在路由里面怎么写,才能让后面的值对应到指定的控制器中的方法

也就是访问http://www.xxx.com/api/signup对应到api控制器下的signup方法,同理signin,create,del,move

Route::controller('api', 'ApiController', [

<code>'signup' => 'api.signup',
'signin' => 'api.signin',
'create' => 'api.create',
'del' => 'api.del',
'move' => 'api.move',</code>
Copy after login

]);

class ApiController extends Controller
{

<code>
public function getSignup()
{
    return 'index';
}

public function getSignin()
{
    return 'create';
}
..........</code>
Copy after login

}

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template