一、TP6设置 首先搭建PHP使用环境,比如phpstudy等,安装composer,通过composer安装tp6。 composer create-project topthink/think tp6 运行TP6 php think
首先搭建PHP使用环境,比如phpstudy等,安装composer,通过composer安装tp6。
composer create-project topthink/think tp6
运行TP6
php think run
也可以进行域名绑定,这样就可以不用运行上面的代码,可以直接使用了。
在文件夹中找到 .example.env 文件,重命名,去掉前面的 .example
或者 找到 config/app.php下的 show_error_msg ,改成 true
一般在 public 中的 .htaccess 中添加即可,配置域名的可以在面板网站后的设置中增加伪静态。
Apache
以下两种都是 Apache 的伪静态配置,选择其中一种使用即可。
#如果mode_rewrite.c模块存在 则执行以下命令 Options +FollowSymlinks -Multiviews RewriteEngine On #开启 rewriteEngine # !-d 不是目录或目录不存在 RewriteCond %{REQUEST_FILENAME} !-d # !-f 不是文件或文件不存在 RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php [QSA,PT,L]
Options +FollowSymlinks -Multiviews DirectoryIndex index.php RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]
nginx
location / { if (!-e $request_filename) { rewrite ^(.*)$ /index.php?s=/$1 last; }}
来源地址:https://blog.csdn.net/qq_53051594/article/details/130583910
--结束END--
本文标题: 用ThinkPHP6写API接口(实现前后端分离一)
本文链接: https://www.lsjlt.com/news/384805.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0