开发者

Performing a full subrequest in Zend Framework

I have the following requirement:

Within an action I have to call a different action, and calculate an md5 hash of the output of a view. The sub-action might set http headers or do other things to globally affect the state of the request/response, so:

How can I perform a fully isolated sub-request and capture it's output?

Edit: Fully isolated is maybe a bit too strong. I just want to be able to kick off the dispatch loop again, and get it's results. I'm not too worried about affecting global state, as our application is relatively clean, but I can't have the sub-request set headers or create output.

I feel there must be an easy way to create a Zend_Controller_Request/Response pair and kick off the dispatch loop again.

What I actually want to do, is to create an md5 hash of the body a specific action would creat开发者_如何学运维e. Excuse my ignorance with ZF (first project!) and crappy question phrasing.


You could use Zend_Http_Client to perform an HTTP request inside your application to your application.

Not sure if there's any other way to perform a completely isolated request.

If you don't need an entirely isolated request, you could try using the ActionStack along with its related action helper.


Could PHP's virtual() function be what you want?


I would just make a cURL call (or choose your pick of libraries for generating an http request).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜