在一个网站上使用多个 php 框架 [英] Using multiple php frameworks on one website

查看:30
本文介绍了在一个网站上使用多个 php 框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的主网站使用 symfony 1,当我开始编写代码时,似乎无法升级(以前开发人员提供的自定义代码太多).现在,我们正在为公司提供的产品添加大量内容.我想使用 CodeIgniter,而不是使用一个非常旧的框架,因为我对它非常熟悉.我真正的问题:

Our main website uses symfony 1, and by the time I started working on the code it seems impossible to upgrade (too much custom code from previous developer). Now we are adding a large addition to what the company offers. Instead of using a really old framework I wanted to use CodeIgniter, also since I'm very familiar with it. My real question:

设置网站以使用多个框架的正确方法是什么.新功能将与原网站分开,但仍需要一些数据库表.

What is a proper way of setting up a website to use multiple frameworks. The new features will be separate from the original website, but it will still need a few tables of the database.

我打算使用 apache 处理根目录取决于 url 的位置,然后正常执行所有操作.主要网站是example.com,新功能将是abc.example.com

I was going to have apache handle where the root directory was depending on the url and just do everything normally. The main website is example.com and the new feature will be abc.example.com

我真的在寻找做过这件事的人,以及他们有过的一些提示和警告.

I'm really looking for people who have done this and some tips and warning they had.

推荐答案

PHP 将根据服务器上加载的目录来运行框架.例如,在大多数 apache 服务器上,example.com 的根目录将是 /www.这意味着 Symphony 的所有代码都在 /www/* 中.

PHP will run the framework based on which directory is loaded on the server. For instance, on most apache servers the root directory for example.com would be /www. Which means all of the code for Symphony would be in /www/*.

当您设置子域的路径时,只需将其放在 /www 文件夹之外.然后,当您访问 abc.example.com 时,apache 不会尝试加载原始站点以及 Symphony 框架.

When you setup the path of your subdomain, just put it outside of the /www folder. Then, when you go to abc.example.com apache won't try to load the original site along with the Symphony framework.

我认为两个框架共享相同的数据库表会很好.我不完全确定您计划如何让这两个应用程序工作,但只要您不更改列名称和类型,您应该没问题.

I think it will be fine for both frameworks to share the same database tables. I'm not entirely sure how you plan for these two applications to work, but as long as you don't change the column names and types you should be okay.

如果您不希望应用程序共享原始表中的数据,请考虑使用 mysqldump 或类似的将数据复制到新表.

If you don't want the applications to share the data in the original table, then look into using mysqldump or something of the like to copy the data over to a new table.

这篇关于在一个网站上使用多个 php 框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆