我是靠谱客的博主 纯真鲜花,这篇文章主要介绍thinkphp6多应用模式,现在分享给大家,希望可以做个参考。

安装thinkphp6

cd D:www
composer create-project topthink/think tp6-admin-api # 项目名称在这里插入图片描述在这里插入图片描述

多应用模式

安装多应用模式扩展think-multi-app
cd D:wwwtp6-admin-api # 进入项目目录
composer require topthink/think-multi-app
在这里插入图片描述

创建admin应用

php think build admin
为应用添加路由
复制根目录下route文件夹到admin应用目录中,修改route目录中的app.php
添加路由规则

#appadminrouteapp.php
<?php
use thinkfacadeRoute;
#/admin/v1/index/(index/add/edit...) 对应  /app/admin/controller/v1/index.php
Route::rule(':version/:controller/:action', 'admin/:version.:controller/:action'); 
#/admin/v1/index  对应 /app/admin/controller/v1/index.php
Route::rule(':version/:controller', 'admin/:version.:controller/index');

遇到问题

执行composer安装thinkphp6时报错:
[InvalidArgumentException]Could not find package topthink/think with stability stable.
删除之前的镜像:composer config -g --unset repos.packagist
再重新安装即可
在这里插入图片描述

最后

以上就是纯真鲜花最近收集整理的关于thinkphp6多应用模式的全部内容,更多相关thinkphp6多应用模式内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(107)

评论列表共有 0 条评论

立即
投稿
返回
顶部