Blogger Information
Blog 5
fans 0
comment 0
visits 6383
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
thinkphp+vue代码部署遇到的坑总结
family的博客
Original
2835 people have browsed it

1.thinkphp版本5.0
2.phpstudy环境版本php-7.0.12nts+apache
3.php array_column()函数即获取数组中的一列数据在phpstudy版本不低于5.5时才可生效,若版本低于5.5可在common.php中加入以下代码:
function array_column($array,$column_name)
{

  1. return array_map(function($element) use($column_name){return $element[$column_name];}, $array);
  2. }

4.vue放入的路径是thinkphp的根目录,在服务器上配置环境时要更改一下网页的首页设置,.html为第一级的优先级,如果是多个vue项目,每个vue项目打包后的目录应该是css js images fonts等参数与index.html是同一级,不同的index.html放到不同的文件夹下,css等参数合并到一起,访问路径即可访问http://或https://域名/自定义的文件名 即可访问
5.成功把vue+thinkphp之间代码部署好了之后就是另一个坑的开始,你们会发现访问相关路径后一刷新thinkphp会直接报错404,解决方案:
vue项目模式改为history模式,具体操作和可能会遇到的坑指路:https://blog.csdn.net/NANGE_BOK/article/details/86095283
thinkPHP要更改伪静态文件即.htaccess文件进行修改:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
具体指路:https://router.vuejs.org/zh/guide/essentials/history-mode.html

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post