我的文件Routes.php 中有这段代码
路线::控制器('/货物/preba','puebaController');
和我的文件PruebController有这个:
<?php
class PruebaController extends BaseController {
protected $layout = 'layouts.master';
public function getTipo(){
//$datos=TipoUsuario::all();
return View::make('cargo.prueba.pbd');
}
}
我需要这个问题的解决方案!
由于路由声明中的根URL
是/cargo/prueba
,因此要调用PruebaController
控制器中的getTipo()
方法,您的URL
将是:
yourdomain.com/cargo/prueba/tipo
因此,如果您在终端/命令提示符下运行php artisan routes
,那么您就会找到答案;它将向您显示访问您的方法的URL
,如下所示:
URL | Action
------------------------------------------------------------------------------------
cargo/prueba/tipo/{one?}/{two?}/{three?}/{four?}/{five?} | PruebaController@getTipo
所以这个类应该是这样的:
class PruebaController extends BaseController {
public function getTipo(){
}
}