标签:laravel fontend backend 后台 前台 结构
# 程序结构如下:
app routes.php models controllers backend IndexController.php fontend IndexController.php
# 后台IndexController.php
<?php namespadce Org\Controllers\BackEnd; class IndexController extends \BaseController { }
# 前台IndexController.php
<?php namespace Org\Controllers\Fontend; class IndexController extends \BaseController { }
# 路由 routes.php
Route::controller(‘/backend‘, ‘Org\Controllers\BackEnd‘);
# 编辑自动加载文件, 非必须执行composer dump-autoload
# 编辑文件 /bootstrap/autoload.php
<?php define(‘LARAVEL_START‘, microtime(true)); /* |-------------------------------------------------------------------------- | Register The Composer Auto Loader |-------------------------------------------------------------------------- | | Composer provides a convenient, automatically generated class loader | for our application. We just need to utilize it! We‘ll require it | into the script here so that we do not have to worry about the | loading of any our classes "manually". Feels great to relax. | */ if ($loader = require __DIR__.‘/../vendor/autoload.php‘) { $map = array( ‘Org\\Controllers\\BackEnd‘ => array( __DIR__.‘/../app/controllers/backend‘, ), ‘Org\Controllers\Fontend‘ => array( __DIR__.‘/../app/controllers/fontend‘, ), ); foreach ($map as $namespace => $path) { $loader->setPsr4($namespace, $path); } }
# 主要还是间接的用了composer的功能,将生成Map的功能写成配置,自动导入。
本文出自 “辨枫拂雪” 博客,请务必保留此出处http://cnhttpd.blog.51cto.com/155973/1536579
Laravel 4:FontEnd/BackEnd环境部署,布布扣,bubuko.com
标签:laravel fontend backend 后台 前台 结构
原文地址:http://cnhttpd.blog.51cto.com/155973/1536579