How do I get the request object from inside the bootstrap file?
I can try this methods but not work.
$request= new Zend_Controller_Request_Http();
$request = Zend_Controller_FrontController::getInstance()->getRequest();
How do I get the request object from inside the bootstrap file?
I can try this methods but not work.
$request= new Zend_Controller_Request_Http();
$request = Zend_Controller_FrontController::getInstance()->getRequest();
You need to bootstrap the frontController first, try something like:
You shouldn't get the request objet, since if you see the dispatch loop, the idea is that the bootstrap are actions prior to execute in a request.
If you need to alter someway of the application use a Controller Plugin to do that.
use the factory instead
http://www.yourweb.com/somecontroller/index/id/12
$id = Zend_Controller_Front::getInstance()->getRequest()->id;
echo $id;
//echo 12
If you really want to, you may achieve this calling:
However, this should be avoided, because the most data you need from the Response object will be available after the front controller is dispatched (eg. module, controller or action name).
The other variables stored in the Response object are extracted from global arrays such as
$_SERVER
,$_POST
or$_GET
which you may exceptionally read directly in bootstrap.But most likely, you want to use Response object in front controller plugin: