美文网首页
自动添加路由

自动添加路由

作者: wflaugh | 来源:发表于2017-02-02 00:07 被阅读0次

    $except= ['BaseController.php','Controller.php'];

    $dir=app_path('Http/Controllers');

    if($handle=opendir($dir)){

    while($file=readdir($handle)) {

    if(!is_dir($dir.'/'.$file) && !in_array($file,$except)) {

    $route=strtolower(substr($file,0,-14));

    $controller=substr($file,0,-4);

    Route::resource($route,$controller);

    }

    }

    closedir($handle);

    }

    相关文章

      网友评论

          本文标题:自动添加路由

          本文链接:https://www.haomeiwen.com/subject/ckwlittx.html