[英]Laravel 4 Error Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException
I have this code in my file Routes.php 我的文件Routes.php中有此代码
Route::controller('/cargo/prueba','PruebaController'); 路线::控制器('/ cargo / prueba','PruebaController');
and my file PruebaController have this: 和我的文件PruebaController具有:
<?php
class PruebaController extends BaseController {
protected $layout = 'layouts.master';
public function getTipo(){
//$datos=TipoUsuario::all();
return View::make('cargo.prueba.pbd');
}
}
I need the solution to this problem please! 我需要解决这个问题的方法!
Since your root URL
in the route declaration is /cargo/prueba
so to invoke the getTipo()
method in PruebaController
controller, your URL
would be this: 由于您在路由声明中的根URL
为/cargo/prueba
因此要在PruebaController
控制器中调用getTipo()
方法, PruebaController
URL
为:
yourdomain.com/cargo/prueba/tipo
So if you run php artisan routes
from terminal/command prompt then you would find the answer; 因此,如果您从终端/命令提示符下运行php artisan routes
,则会找到答案; which will show you the URL
to access your method and it's given below: 它将显示给您访问方法的URL
,如下所示:
URL | Action
------------------------------------------------------------------------------------
cargo/prueba/tipo/{one?}/{two?}/{three?}/{four?}/{five?} | PruebaController@getTipo
So the class should be something like this: 所以该类应该是这样的:
class PruebaController extends BaseController {
public function getTipo(){
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.