Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何使用专用路由器在 CakePHP 中使用虚拟化创建子域?
发送到地址
sabz.domain.com/blog/posts/view/10
至
domain.com/blog/posts/view/10/sub:sabz
在 routes.php 中使用以下代码
$subdomain = substr(env("HTTP_HOST"), 0, strpos(env("HTTP_HOST"),"."));
if ($subdomain != 'domain') { Router::connect('/', array('controller' => 'homes', 'action' =>'userview', 'pass' => $subdomain)); }
并根据您的需要进行更改。