当前位置: 首页>>代码示例>>PHP>>正文


PHP HTTPRequest::requestVar方法代码示例

本文整理汇总了PHP中HTTPRequest::requestVar方法的典型用法代码示例。如果您正苦于以下问题:PHP HTTPRequest::requestVar方法的具体用法?PHP HTTPRequest::requestVar怎么用?PHP HTTPRequest::requestVar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HTTPRequest的用法示例。


在下文中一共展示了HTTPRequest::requestVar方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: redirectBack

	/**
	 * Redirect back. Uses either the HTTP_REFERER or a manually set request-variable called
	 * _REDIRECT_BACK_URL.
	 * This variable is needed in scenarios where not HTTP-Referer is sent (
	 * e.g when calling a page by location.href in IE).
	 * If none of the two variables is available, it will redirect to the base
	 * URL (see {@link Director::baseURL()}).
	 * @uses redirect()
	 */
	function redirectBack() {
		if($this->request->requestVar('_REDIRECT_BACK_URL')) {
			$url = $this->request->requestVar('_REDIRECT_BACK_URL');
		} else if($this->request->getHeader('Referer')) {
			$url = $this->request->getHeader('Referer');
		} else {
			$url = Director::baseURL();
		}

		$this->redirect($url);
	}
开发者ID:neopba,项目名称:silverstripe-book,代码行数:20,代码来源:Controller.php

示例2: redirectBack

 /**
  * Redirect back. Uses either the HTTP_REFERER or a manually set request-variable called
  * _REDIRECT_BACK_URL.
  * This variable is needed in scenarios where not HTTP-Referer is sent (
  * e.g when calling a page by location.href in IE).
  * If none of the two variables is available, it will redirect to the base
  * URL (see {@link Director::baseURL()}).
  * @uses redirect()
  */
 function redirectBack()
 {
     if ($this->request->requestVar('_REDIRECT_BACK_URL')) {
         $url = $this->request->requestVar('_REDIRECT_BACK_URL');
     } else {
         if ($this->request->getHeader('Referer')) {
             $url = $this->request->getHeader('Referer');
         } else {
             $url = Director::baseURL();
         }
     }
     // absolute redirection URLs not located on this site may cause phishing
     if (Director::is_site_url($url)) {
         return $this->redirect($url);
     } else {
         return false;
     }
 }
开发者ID:racontemoi,项目名称:shibuichi,代码行数:27,代码来源:Controller.php


注:本文中的HTTPRequest::requestVar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。