Controller/Action/Helper/Redirector.php
Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled
with this package in the file LICENSE.txt.
It is also available through the world-wide-web at this URL:
http://framework.zend.com/license/new-bsd
If you did not receive a copy of the license and are unable to
obtain it through the world-wide-web, please send an email
to license@zend.com so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Controller
- Subpackage
- Zend_Controller_Action_Helper
- Version
- $Id$
\Zend_Controller_Action_Helper_Redirector
Package: Zend_Controller\Zend_Controller_Action_Helper- Parent(s)
- \Zend_Controller_Action_Helper_Abstract
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Properties



boolean $_closeSessionOnExit = trueWhether or not to close the session before exiting
Default valuetrueDetails- Type
- boolean



int $_code = 302HTTP status code for redirects
Default value302Details- Type
- int



boolean $_exit = trueWhether or not calls to _redirect() should exit script execution
Default valuetrueDetails- Type
- boolean



boolean $_prependBase = trueWhether or not _redirect() should attempt to prepend the base URL to the
passed URL (if it's a relative URL)
Default valuetrueDetails- Type
- boolean



boolean $_useAbsoluteUri = falseWhether or not to use an absolute URI when redirecting
Default valuefalseDetails- Type
- boolean
Methods



_checkCode(int $code) : trueValidate HTTP status redirect code
Parameters| Name | Type | Description |
|---|
| $code | int | |
|---|
ReturnsThrows 


_prependBase(string $url) : stringDetermine if the baseUrl should be prepended, and prepend if necessary
Parameters| Name | Type | Description |
|---|
| $url | string | |
|---|
Returns 


direct(string $action, string $controller = null, string $module = null, array $params = array()) : voiddirect(): Perform helper when called as
$this->_helper->redirector($action, $controller, $module, $params)
Parameters| Name | Type | Description |
|---|
| $action | string | |
|---|
| $controller | string | |
|---|
| $module | string | |
|---|
| $params | array | |
|---|



gotoRoute(array $urlOptions = array(), string $name = null, boolean $reset = false, boolean $encode = true) : voidRedirect to a route-based URL
Uses route's assemble method tobuild the URL; route is specified by $name;
default route is used if none provided.
Parameters| Name | Type | Description |
|---|
| $urlOptions | array | Array of key/value pairs used to assemble URL |
|---|
| $name | string | |
|---|
| $reset | boolean | |
|---|
| $encode | boolean | |
|---|



gotoRouteAndExit(array $urlOptions = array(), string $name = null, boolean $reset = false) : voidRedirect to a route-based URL, and immediately exit
Uses route's assemble method tobuild the URL; route is specified by $name;
default route is used if none provided.
Parameters| Name | Type | Description |
|---|
| $urlOptions | array | Array of key/value pairs used to assemble URL |
|---|
| $name | string | |
|---|
| $reset | boolean | |
|---|



gotoSimple(string $action, string $controller = null, string $module = null, array $params = array()) : voidPerform a redirect to an action/controller/module with params
Parameters| Name | Type | Description |
|---|
| $action | string | |
|---|
| $controller | string | |
|---|
| $module | string | |
|---|
| $params | array | |
|---|



gotoSimpleAndExit(mixed $action, mixed $controller = null, mixed $module = null, array $params = array()) : voidPerform a redirect to an action/controller/module with params, forcing an immdiate exit
Parameters| Name | Type | Description |
|---|
| $action | mixed | |
|---|
| $controller | mixed | |
|---|
| $module | mixed | |
|---|
| $params | array | |
|---|



gotoUrl(string $url, array $options = array()) : voidPerform a redirect to a url
Parameters| Name | Type | Description |
|---|
| $url | string | |
|---|
| $options | array | |
|---|



gotoUrlAndExit(string $url, array $options = array()) : voidSet a URL string for a redirect, perform redirect, and immediately exit
Parameters| Name | Type | Description |
|---|
| $url | string | |
|---|
| $options | array | |
|---|



setCloseSessionOnExit(boolean $flag) : \Zend_Controller_Action_Helper_RedirectorSet flag for whether or not {@link redirectAndExit()} shall close the session before exiting.
Parameters| Name | Type | Description |
|---|
| $flag | boolean | |
|---|
Returns 


setGotoRoute(array $urlOptions = array(), string $name = null, boolean $reset = false, boolean $encode = true) : voidBuild a URL based on a route
Parameters| Name | Type | Description |
|---|
| $urlOptions | array | |
|---|
| $name | string | Route name |
|---|
| $reset | boolean | |
|---|
| $encode | boolean | |
|---|



setGotoSimple(string $action, string $controller = null, string $module = null, array $params = array()) : voidSet a redirect URL of the form /module/controller/action/params
Parameters| Name | Type | Description |
|---|
| $action | string | |
|---|
| $controller | string | |
|---|
| $module | string | |
|---|
| $params | array | |
|---|



setGotoUrl(string $url, array $options = array()) : voidSet a redirect URL string
By default, emits a 302 HTTP status header, prepends base URL as defined
in request object if url is relative, and halts script execution by
calling exit().
$options is an optional associative array that can be used to control
redirect behaviour. The available option keys are:
- exit: boolean flag indicating whether or not to halt script execution when done
- prependBase: boolean flag indicating whether or not to prepend the base URL when a relative URL is provided
- code: integer HTTP status code to use with redirect. Should be between 300 and 307.
_redirect() sets the Location header in the response object. If you set
the exit flag to false, you can override this header later in code
execution.
If the exit flag is true (true by default), _redirect() will write and
close the current session, if any.
Parameters| Name | Type | Description |
|---|
| $url | string | |
|---|
| $options | array | |
|---|