这个链接是安装tp6框架初始配置
http://t.csdn.cn/Lmzd6http://t.csdn.cn/Lmzd6
安装好新的框架 再使用多应用模式
五、多应用模式
配置多应用模式 TP6默认的是单应用模式,需要自己开启多应用模式
1.安装多应用模式扩展 think-multi-app 注意此处获取位置不能再获取tp6目录的位置执行,应进入项目目录,我前面项目目录在tp,所以需要进入tp文件夹中获取扩展,如果使用phpstorm打开可直接在左下角终端执行。
composer require topthink/think-multi-app
2. 删除原有的controller文件 (必须删)
3. 修改配置文件开启多应用模式 修改config/app.php文件,没有的话不用更改
// 开启多应用 'auto_multi_app' => true
4. 创建应用 php think build demo demo是应用名称,可自行修改
我创建了三个应用:
访问方式: http://localhost/index.php/demo/index
http://localhost/index.php/index/index
http://localhost/index.php/admin/index
修改.htaccess文件,隐藏index.php 注意:修改的是public目录下的.htaccess文件
<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>
http://localhost/index/index
http://localhost/admin/index
设置默认应用 在config/app.php中修改配置:
// 默认应用 'default_app' => 'demo'