快捷路由
快捷路由允許你快速給控制器注冊(cè)路由,并且針對(duì)不同的請(qǐng)求類(lèi)型可以設(shè)置方法前綴,例如:
// 給User控制器設(shè)置快捷路由
Route::controller('user','index/User');
User控制器定義如下:
namespace app\index\controller;
class User {
public function getInfo()
{
}
public function getPhone()
{
}
public function postInfo()
{
}
public function putInfo()
{
}
public function deleteInfo()
{
}
}
我們可以通過(guò)下面的URL訪(fǎng)問(wèn)
get http://localhost/user/info
get http://localhost/user/phone
post http://localhost/user/info
put http://localhost/user/info
delete http://localhost/user/info
文檔最后更新時(shí)間:2018-04-25 19:31:37
未解決你的問(wèn)題?請(qǐng)到「問(wèn)答社區(qū)」反饋你遇到的問(wèn)題