本文整理汇总了PHP中Zend_Controller_Response_Http::isRedirect方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Response_Http::isRedirect方法的具体用法?PHP Zend_Controller_Response_Http::isRedirect怎么用?PHP Zend_Controller_Response_Http::isRedirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Controller_Response_Http
的用法示例。
在下文中一共展示了Zend_Controller_Response_Http::isRedirect方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testPreDispatchNonWhitelistedAction
public function testPreDispatchNonWhitelistedAction()
{
$this->request->setModuleName('default')->setControllerName('foo')->setActionName('home');
$this->plugin->preDispatch($this->request);
$this->assertTrue($this->response->isRedirect());
$responseHeaders = $this->response->getHeaders();
$this->assertEquals('/user/login', $responseHeaders[0]['value']);
}
示例2: sendResponse
/**
* Send response to browser with json content type
*/
public function sendResponse()
{
$this->_response = Mage::app()->getResponse();
//check redirect
if ($this->_response->isRedirect()) {
$headers = $this->_response->getHeaders();
$redirect = '';
foreach ($headers as $header) {
if ("Location" == $header["name"]) {
$redirect = $header["value"];
break;
}
}
if ($redirect) {
$this->setRedirect($redirect);
}
}
$this->_response->clearHeaders();
$this->_response->setHeader('Content-Type', 'application/json');
$this->_response->clearBody();
$this->_response->setBody($this->toJson());
$this->_response->sendResponse();
exit;
}
示例3: redirects
/**
* Asserts that the response is a redirect.
*/
public function redirects()
{
$message = 'Response does not perform a redirect.';
PHPUnit_Framework_Assert::assertTrue($this->response->isRedirect(), $message);
}