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


PHP RequestHandler::Link方法代码示例

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


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

示例1: getBackURL

 /**
  * Get's the previous URL that lead up to the current request.
  *
  * NOTE: Honestly, this should be built into SS_HTTPRequest, but we can't depend on that right now... so instead,
  * this is being copied verbatim from Controller (in the framework).
  *
  * @param SS_HTTPRequest $request
  * @return string
  */
 protected function getBackURL(SS_HTTPRequest $request)
 {
     // Initialize a sane default (basically redirects to root admin URL).
     $controller = $this->getToplevelController();
     $url = method_exists($this->requestHandler, "Link") ? $this->requestHandler->Link() : $controller->Link();
     // Try to parse out a back URL using standard framework technique.
     if ($request->requestVar('BackURL')) {
         $url = $request->requestVar('BackURL');
     } else {
         if ($request->isAjax() && $request->getHeader('X-Backurl')) {
             $url = $request->getHeader('X-Backurl');
         } else {
             if ($request->getHeader('Referer')) {
                 $url = $request->getHeader('Referer');
             }
         }
     }
     return $url;
 }
开发者ID:burnbright,项目名称:silverstripe-importexport,代码行数:28,代码来源:GridFieldImporter_Request.php

示例2: import

 /**
  * Import the current file
  * @param  SS_HTTPRequest $request
  */
 public function import(SS_HTTPRequest $request)
 {
     $hasheader = (bool) $request->postVar('HasHeader');
     $cleardata = $this->component->getCanClearData() ? (bool) $request->postVar('ClearData') : false;
     if ($request->postVar('action_import')) {
         $file = File::get()->byID($request->param('FileID'));
         if (!$file) {
             return "file not found";
         }
         $colmap = Convert::raw2sql($request->postVar('mappings'));
         if ($colmap) {
             //save mapping to cache
             $this->cacheMapping($colmap);
             //do import
             $results = $this->importFile($file->getFullPath(), $colmap, $hasheader, $cleardata);
             $this->gridField->getForm()->sessionMessage($results->getMessage(), 'good');
         }
     }
     $controller = $this->getToplevelController();
     $url = method_exists($this->requestHandler, "Link") ? $this->requestHandler->Link() : $controller->Link();
     $controller->redirect($url);
 }
开发者ID:botzkobg,项目名称:silverstripe-importexport,代码行数:26,代码来源:GridFieldImporter_Request.php


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