首页 > 其他 > 详细

Laravel 4:FontEnd/BackEnd环境部署

时间:2014-08-07 07:27:00      阅读:251      评论:0      收藏:0      [点我收藏+]

# 程序结构如下:

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 4:FontEnd/BackEnd环境部署

原文:http://cnhttpd.blog.51cto.com/155973/1536579

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!