thinkphp5 uniapp 绑定到首页
2023-03-29 23:03:03
154
{{single.collect_count}}

如何将uniapp生成的h5网站添加到thinkphp框架下的首页?

1 将public下入口文件重新命名为home.php

2 设置伪静态 这里已nginx为案例

location / {if (!-e $request_filename){rewrite^(.*)$/home.php?s=$1last; break;}}

此时可以访问正常访问网站了 但由于缺失默认index文件导致404

3 将uniapp生成的h5文件里的index.html 上传到网站根目录 此时可以正常打开uniappH5首页了

4 打开其他页面包含pages/路由的页面 将提示无法找到pages模块 那么只要在nginx里将这个pages目录排除掉 并指想index.html即可

那么在thinkphp伪静态前添加一条排除伪静态即可

location ~* ^/pages/ {default_type text/html;alias/www/wwwroot/网站目录/public/index.html;}

回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}