ThinkPHP应用分组部署与访问

来源:互联网 发布:什么是淘宝众筹 编辑:程序博客网 时间:2024/04/28 23:09

1.创建项目唯一入口文件index.php

<?php
    define('APP_NAME','App');
    define('APP_PATH','./App/');
    define('APP_DEBUG', TRUE);
    require 'ThinkPHP/ThinkPHP.php';
?>


2.创建公共配置文件夹及文件 Conf/config.php

要想实现应用分组必须配置如下两个参数:

'APP_GROUP_LIST' => 'Index,Admin',//应用分组列表

'DEFAULT_GROUP'=> 'Index',//默认分组


3.在项目应用的配置文件(App/Conf/config.php)中加载公共配置内容:

return array_merge(include './Conf/config.php',$array);  //$arry 为本配置文件中额外添加的配置项


4.在Action、Model下进行分组Index,Admin目录结构如下:



5.浏览器方法:

访问Index下Index模块index操作地址:http://localhost/index.php/Index/Index/index 或 http://localhost/index.php/Index/index 因为Index为默认分组

访问Admin下Index模块index操作地址:http://localhost/index.php/Admin/Index/index

注:index.php可以通过在apache下进行配置而不需要输入。

原创粉丝点击