本文介绍了CakePHP多站点(如WPMU +域映射)...可能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我刚刚开始使用CakePHP,并且想知道是否可能有以下情况:

So I'm just starting to play with CakePHP and was wondering if the following was possible:

单独安装Cake,具有超级管理员登录。然后,有权访问指定的子网站的管理员,以及在这些子网站上创建/编辑内容和用户的能力。最后,将域名(不是子域,但唯一域)映射到路由的能力;所以,而不是mysite.com/subsite/posts/1它只是newdomain.com/posts/1

A single install of Cake, with a super admin login. Then, admins that have access to specified "sub sites", and the ability to create/edit content and users on those sub sites. Finally, the ability to map domain names (not subdomains, but unique domains) to the routes; so instead of mysite.com/subsite/posts/1 it would just be newdomain.com/posts/1

本质上,我想复制使用的经验Wordpress多用户(带域映射)。

Essentially, I'm looking to replicate the experience of using Wordpress Multi-user (with domain mapping).

这是可能吗?如果是,我应该查看什么?

Is this possible? If so, what should I be looking into?

推荐答案

当然。你甚至可以使用相同的代码集,只需配置某些域来指向代码。然后在代码库中,将域ID绑定到每个用户和内容,以便知道它所属的位置。您可以让管理员用户属于所有域。然后,当您添加常规用户时,您可以指定它们属于哪个域。

Sure. You can even use the same set of code and just configure certain domains to point to the code. Then in the code base, tie a domain ID to each user and the content so it knows where it belongs. You can have admin users belong to all domains. Then when you add regular users, you can specify what domain they belong to.

您可以在Config / bootstrap.php中建立域检查,域如下:

You could establish the domain checking in the Config/bootstrap.php and then set the configuration for the domain like so:

Configure::write('domain_id', 'someDomainSpecificID');

然后,您只需要从多个域维护一组代码和一个数据库。

Then you only have to maintain one set of code and one database from many domains.

如果域必须在物理上分开,您可以为ADMIN用户(单个数据库)设置一个位置,并运行一切。

If the domains have to be physically separate, you could set up one location for the ADMIN users (single database) and run everything against that.

有很多方法可以构建它,它只是取决于你的具体需求是什么。这听起来像一个很酷的项目。

There are many ways you could architect it, it just depends on what your specific needs are. It sounds like a cool project though.

这篇关于CakePHP多站点(如WPMU +域映射)...可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 00:05