首页 > 代码库 > Laravel 4:FontEnd/BackEnd环境部署
Laravel 4: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
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。