您的位置:首页 > 编程语言 > PHP开发

ThinkPHP应用分组部署与访问

2013-08-17 20:19 197 查看
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下进行配置而不需要输入。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: