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


PHP Rewrite::getTargetUrl方法代码示例

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


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

示例1: analyzeUrl

 public function analyzeUrl()
 {
     // Check if URL is set in general
     if (is_null($this->url)) {
         throw new Exception("No request URL set!");
         return;
     }
     // Check for rewrtite rules
     $rewrite = new Rewrite($this->url);
     $rewrite->applyRules();
     if ($rewrite->getTargetUrl() != $this->url) {
         if (!$rewrite->transportQueryParameter()) {
             $_GET = array();
             $_POST = array();
         }
         if ($rewrite->isRedirect()) {
             $this->redirectToUrl($rewrite->getTargetUrl(), $_POST);
         }
         $this->setUrl($rewrite->getTargetUrl());
         $this->analyzeRequest(!$rewrite->isLastForward());
     }
     // Check access rights to requested content
     $access = new AccessOfficer("content", $this->content_id, $this->session->getUser(), $this->content_parents);
     if (!$access->check()) {
         // Access denied
         if (!$access->getDeniedContentID()) {
             // No content to be shown as 403 page set
             // TODO set up default 403 (and 404) templates
             throw new Exception("Access denied and no denied content defined!");
             return;
         }
         // Should parameters be transported through the redirects / rewrites
         if (!$access->transportQueryParameter()) {
             $_GET = array();
             $_POST = array();
         }
         // Show 403 error page or redirect if neccessary
         $newcontent = new Content($access->getDeniedContentID());
         if ($access->isRedirect() && $newcontent->getID() != $this->content_id) {
             // Redirect, but keep requested URL as origin parameter
             // TODO: keep origin request parameters as well!
             $this->redirectToUrl("/" . $newcontent->getUrl() . "?origin=" . $this->url, $_POST);
         }
         $this->setUrl($newcontent->getUrl());
         $this->analyzeRequest(!$access->isLastForward());
     }
     // TODO: HookPoints to manipulate this behaviour
 }
开发者ID:julianburr,项目名称:project-nutmouse,代码行数:48,代码来源:Controller.php


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