简体   繁体   English

laravel 4中的一些路由问题

[英]Some Routing problems in laravel 4

I am new to laravel 4 framework but was previously working on CI and CakePHP, i have some problems with routes in it (i may sound nerd, so bear with me.) 我是laravel 4框架的新手,但之前从事CI和CakePHP的开发,我在其中的路由存在一些问题(我可能听起来很书呆子,所以请多多包涵。)

-> If i have 3 controller userController,adminController,editorController and many methods inside them, do i need to define routes for every methods inside it (ofcourse i am not using ResourceFull controller for them). ->如果我内部有3个控制器userController,adminController,editorController和许多方法,我是否需要为其中的每个方法定义路由(当然我没有为它们使用ResourceFull控制器)。 Can't i have something by which the methods can be accessed by using the controllername followed by method name like we do in other frameWork. 我不能像在其他frameWork中一样,通过使用controllername和方法名来访问方法的方法。 Eg usersController have manageUser method, i wnt to access it like 例如usersController有manageUser方法,我想像访问它

http://localhost/project/users/manageUser

-> What is use of defining a route using Route::controller('users', 'UserController'); ->使用Route :: controller('users','UserController');定义路由的用途是什么? or restfull controller? 或restfull控制器?

Thanks in advance :) 提前致谢 :)

If you write Route::controller('users', 'UserController') runs the default function (index of all the objects), but you can write: 如果编写Route :: controller('users','UserController')运行默认功能(所有对象的索引),但是您可以编写:

Route::get('/users', 'userController@function'); 路线:: get('/ users','userController @ function'); or Route::post('/users', 'userController@function'); 或Route :: post('/ users','userController @ function');

this route shows to Laravel what controller and function can call when you write this route, the diference is if you pass the parameters with get or post mode. 此路由向Laravel显示在编写此路由时可以调用什么控制器和函数,不同之处在于是否以get或post模式传递参数。

Hope I help you 希望我能帮到你

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM