當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Url::fromMagic方法代碼示例

本文整理匯總了PHP中Cx\Core\Routing\Url::fromMagic方法的典型用法代碼示例。如果您正苦於以下問題:PHP Url::fromMagic方法的具體用法?PHP Url::fromMagic怎麽用?PHP Url::fromMagic使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Cx\Core\Routing\Url的用法示例。


在下文中一共展示了Url::fromMagic方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testFileUrls

 public function testFileUrls()
 {
     $testResult = 'file://' . getcwd();
     $url = Url::fromRequest();
     $this->assertEquals($testResult, $url->toString());
     $this->assertEquals(getcwd(), (string) $url);
     $url = Url::fromMagic($testResult);
     $this->assertEquals($testResult, $url->toString());
     $this->assertEquals(getcwd(), (string) $url);
 }
開發者ID:nahakiole,項目名稱:cloudrexx,代碼行數:10,代碼來源:URLTest.class.php

示例2: redirect

 /**
  * Redirect
  *
  * This function redirects the client. This is done by issuing
  * a "Location" header and exiting if wanted.  If you set $rfc2616 to true
  * HTTP will output a hypertext note with the location of the redirect.
  *
  * @static
  * @access  public
  * @return  mixed   Returns true on succes (or exits) or false if headers
  *                  have already been sent.
  * @param   string  $url URL where the redirect should go to.
  * @param   bool    $exit Whether to exit immediately after redirection.
  * @param   bool    $rfc2616 Wheter to output a hypertext note where we're
  *                  redirecting to (Redirecting to <a href="...">...</a>.)
  */
 public static function redirect($url, $exit = true, $rfc2616 = false)
 {
     if (headers_sent()) {
         return false;
     }
     $url = \Cx\Core\Routing\Url::fromMagic($url);
     $url = $url->toString();
     // use absolute url
     self::header('Location: ' . $url);
     if ($rfc2616 && isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'HEAD') {
         printf('Redirecting to: <a href="%s">%s</a>.', $url, $url);
     }
     if ($exit) {
         exit;
     }
     return true;
 }
開發者ID:hbdsklf,項目名稱:LimeCMS,代碼行數:33,代碼來源:Csrf.class.php

示例3: resolve

 /**
  * Resolve
  */
 public function resolve(\Cx\Core\Routing\Url $url, &$continue)
 {
     if (!$this->matches($url)) {
         return $url;
     }
     $continue = $this->getContinueOnMatch();
     $newUrl = \Cx\Core\Routing\Url::fromMagic($this->getRegularExpression()->replace($url->toString()));
     \DBG::log('Redirecting to ' . $newUrl->toString());
     return $newUrl;
 }
開發者ID:nahakiole,項目名稱:cloudrexx,代碼行數:13,代碼來源:RewriteRule.class.php


注:本文中的Cx\Core\Routing\Url::fromMagic方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。