开发者

When is controller other than Zend_Controller_Request_Http

I keep seeing this line of code in many plugins. What exactly does it do, and what othe开发者_StackOverflowr possibilities are there other than Request_Http

if (!$request instanceof Zend_Controller_Request_Http)
    return;


I believe that originally all of ZF's routing was based on the REQUEST_URI, so many of the routing classes operated on $request which was a string. In order to facilitate things such as routing for subdomains this was changed so that the whole request object was passed in. So checks such as the one in your example are merely checking that $request is a request object (and not a string) before calling its methods.

(Disclaimer: this is speculation based on my knowledge of ZF's routing classes, I may be wrong!)


Sifting through the Zend Framework docs, I see that a sibling class of Zend_Controller_Request_Http is Zend_Controller_Request_Simple, which is used to get information about command-line requests to a ZF application. The plugins in question probably only work for web apps requested using a browser (or whatever HTTP client), so these plugins back out otherwise.


Even it is unusual every class, that extends Zend_Controller_Request_Abstract can occur.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜