关于Zend框架子域重定向查询 [英] Query regarding subdomain redirection in Zend Framework

查看:182
本文介绍了关于Zend框架子域重定向查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找使用Zend Framework的方法 - 像bit.ly和TinyURL的相似点 - 在那里我可以请求到子域和子域存储在一个变量。

I was looking for an approach using Zend Framework - similar to sites like bit.ly and tinyurl - where I can take a request to a subdomain and store the subdomain in a variable.

例如,一个请求到localhost / ABCDEF将返回$ = S ABCDEF。我不知道如何做到这一点的ZF,其中一个请求到localhost / ABCDEF将返回ABCDEF控制器的init()。

For instance, a request to localhost/abcdef will return $s = abcdef. I'm not sure how to accomplish this in ZF, where a request to localhost/abcdef will return the init() of the abcdef controller.

感谢所有帮助!

推荐答案

只需使用正则表达式的路由。

Just use a regex route.

$routeitem = new Zend_Controller_Router_Route_Regex('(.*)',
                    array(1 => '', 'controller' => 'redir', 'action' => 'view'),
                    array(1 => 'hash'),
                    '%s'
    );

您可以再拿到从_getParam方法,你的哈希的重定向。

You can then get your "hash" redirection from the _getParam method.

这篇关于关于Zend框架子域重定向查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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