在laravel5中使用类方法时需要use,能不能一次性全部引入?经常不知道要引入哪个好useRequest;useSession;useView;useDB;classTestControllerextendsController{publicfunctiongetIndex(){$data['name']='laravel';returnView::make('hi',$data);}publicfunctiongetName(){$rs=DB::select("select*fromcf_user");print_r($rs);}//获取ip地址publicfunctiongetIp(){echoRequest::ip();}//publicfunctiongetTest(){echo123;}publicfunctiongetDetail($id){echo$id;}publicfunctiongetFullUrl(){echoRequest::fullUrl();}publicfunctiongetType(){echoRequest::method();}publicfunctiongetRoot(){echoRequest::root();}publicfunctiongetUrl(){echoRequest::url();}publicfunctiongetSe(){print_r(Request::segments());}publicfunctiongetAll(){print_r(Request::all());}publicfunctiongetH(){print_r(Request::header('cookie'));}publicfunctiongetServer(){print_r(Request::server());}publicfunctiongetSession(){print_r(Request::session());}}
婷婷同学_
MMTTMM
相关分类