如何将Vue.js与ThinkPHP高效整合?

2026-05-07 13:320阅读0评论SEO资源
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计561个文字,预计阅读时间需要3分钟。

如何将Vue.js与ThinkPHP高效整合?

相关专题

1、前端跨域调用后端数据。

2、前端打包文件部署在后端的服务器文件夹下(同域)。

立即学习“PHP免费学习笔记(深入)”;

web服务器: apache

如:跨域

在服务器配置站点:

在路径/home/www/ 下创建test项目文件夹,用来放项目文件。 找到httpd-vhosts.conf文件配置站点 前端站点: <VirtualHost *:80> ServerName test.test.com DocumentRoot "/home/www/test/dist" DirectoryIndex index.html </VirtualHost> 后端站点: <VirtualHost *:80> ServerName test.testphp.com DocumentRoot "/home/www/test/php" DirectoryIndex index.php </VirtualHost>

将前端打包好的dist文件放在/home/www/test/ 文件夹下,运行http://test.test.com可浏览,当路径改变时,刷新会出现404错误。此时dist文件下创建一个.htaccess文件,当路径不存在时,路径指向http://test.test.com/index.html能解决此问题。

阅读全文
标签:ThinkPHP

本文共计561个文字,预计阅读时间需要3分钟。

如何将Vue.js与ThinkPHP高效整合?

相关专题

1、前端跨域调用后端数据。

2、前端打包文件部署在后端的服务器文件夹下(同域)。

立即学习“PHP免费学习笔记(深入)”;

web服务器: apache

如:跨域

在服务器配置站点:

在路径/home/www/ 下创建test项目文件夹,用来放项目文件。 找到httpd-vhosts.conf文件配置站点 前端站点: <VirtualHost *:80> ServerName test.test.com DocumentRoot "/home/www/test/dist" DirectoryIndex index.html </VirtualHost> 后端站点: <VirtualHost *:80> ServerName test.testphp.com DocumentRoot "/home/www/test/php" DirectoryIndex index.php </VirtualHost>

将前端打包好的dist文件放在/home/www/test/ 文件夹下,运行http://test.test.com可浏览,当路径改变时,刷新会出现404错误。此时dist文件下创建一个.htaccess文件,当路径不存在时,路径指向http://test.test.com/index.html能解决此问题。

阅读全文
标签:ThinkPHP