douli1872 2016-01-16 08:39
浏览 214
已采纳

Laravel自定义控制器出现404错误

i have simple custom controller in route as :

Route::controller(
    'validationMobiles', 'ValidationMobilesController',
    [
        'getIndex' => 'validationMobiles.index',
    ]
);

unfortunately i get 404 error after run this url :

http://localhost/laravel/public/validationMobiles.index

My Controller:

namespace App\Http\Controllers;
class ValidationMobilesController extends Controller
{
    public function getIndex()
    {
        dd('ss');
    }
}

UPDATED:

full controll, this method work fine in laravel 4, in laravel 5 i added namespace:

Route::controller(
    'validationMobiles', 'ValidationMobilesController',
    [
        'getIndex' => 'validationMobiles.index',
        'postUpdate' => 'validationMobiles.update',
        'postEdit' => 'validationMobiles.edit',
        'getDelete' => 'validationMobiles.delete',
        'getAccept' => 'validationMobiles.accept',
        'getResend' => 'validationMobiles.resend',
    ]
);
  • 写回答

1条回答 默认 最新

  • dtv11049 2016-01-16 09:38
    关注

    validationMobiles.index is the name of the route you've given, not the url. If your controller method is getIndex, that method will handle a GET request to the validationMobiles/index url (http://localhost/laravel/public/validationMobiles/index).

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 关于#r语言#rda分析作图的问题,请各位专家解答!
  • ¥50 找回 股票行情系统的资源问题
  • ¥15 gwas 分析-plink 检查人口分层出现下面问题
  • ¥15 关于#matlab#的问题:需要 MATLAB 运行程序,对比四个多址通信方式(TDMA,FDMA,CDMA,OFDMA)的抗噪声性能
  • ¥15 有没有复现过PFENet的,如何解决?
  • ¥15 vue3使用swiper轮播图循环失败
  • ¥15 FDMA,OFDMA,TDMA 和 CDMA 系统容量对比仿真
  • ¥15 图神经网络的入侵检测
  • ¥15 工业数据采集技术+存储架构推荐
  • ¥15 GPT-SOVITS如何训练少数民族语言支持合成语音