关于Zend框架子域重定向查询重定向、框架、Zend

由网友(你压到我腿毛了)分享简介:我一直在寻找使用Zend Framework的方法 - 像bit.ly和TinyURL的相似点 - 在那里我可以请求到子域和子域存储在一个变量。 I was looking for an approach using Zend Framework - similar to sites like bit.ly and...

我一直在寻找使用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.

阅读全文

相关推荐

最新文章