dpaal28266
2015-09-30 06:13
浏览 136
已采纳

Laravel5.1 Route将所有URL设置为Controller

I think get/post visit Controller

Route::match(['get','post']. '{Controller}/{method}','$Controller\$Controller_Controller@$method');

But this is error;

How to I localhos/website/User/login ,go to find Controllers/User/User_Controller@login?

图片转代码服务由CSDN问答提供 功能建议

我认为访问/访问控制器

  Route ::  match(['get','post']。'{Controller} / {method}','$ Controller \ $ Controller_Controller @ $ method'); 
   
 
 

但这是错误;

如何在localhos / website / User / login中找到Controllers / User / User_Controller @ login?

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

2条回答 默认 最新

  • dongzi5673 2015-10-02 03:15
    最佳回答

    Sorry,my question maybe unclear,by the view i can a one route to find all view ,resource :

    Route::get('/{pac}/{menthod}',function($pac,$method){
    $url = $pac . "." . $method;
    return view($url);
    });
    

    but the controller

    i try

    //this is error
    Route::match(['get','post'],'Controoler/{Controller}/{method}',$Controller ."@". $method);
    

    or

    //but the return a string to view  
    Route::match(['get','post'].'{Controller}/{method}',function($Controller,$method){
        $url = $controller . "@" . $method;
        return $url;
    });
    
    评论
    解决 无用
    打赏 举报
查看更多回答(1条)

相关推荐 更多相似问题