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


PHP HTTP::absoluteURI方法代码示例

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


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

示例1: 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.
     *
     * @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>.)
     *
     * @return boolean  Returns TRUE on succes (or exits) or FALSE if headers
     *                  have already been sent.
     * @static
     * @access public
     */
    function redirect($url, $exit = true, $rfc2616 = false)
    {
        if (headers_sent()) {
            return false;
        }
        $url = HTTP::absoluteURI($url);
        header('Location: ' . $url);
        if ($rfc2616 && isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'HEAD') {
            echo '
<p>Redirecting to: <a href="' . str_replace('"', '%22', $url) . '">' . htmlspecialchars($url) . '</a>.</p>
<script type="text/javascript">
//<![CDATA[
if (location.replace == null) {
    location.replace = location.assign;
}
location.replace("' . str_replace('"', '\\"', $url) . '");
// ]]>
</script>';
        }
        if ($exit) {
            exit;
        }
        return true;
    }
开发者ID:nshiff,项目名称:magento-example,代码行数:40,代码来源:HTTP.php

示例2: redirect

 /**
  * Redirect
  * 
  * This function redirects the client.  This is done by issuing
  * a "Location" header and exiting if wanted.
  * 
  * @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.
  */
 function redirect($url, $exit = true)
 {
     if (headers_sent()) {
         return false;
     }
     header('Location: ' . HTTP::absoluteURI($url));
     if ($exit) {
         exit;
     }
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:smart-svn,代码行数:24,代码来源:HTTP.php

示例3: 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>.)
  */
 function redirect($url, $exit = true, $rfc2616 = false)
 {
     if (headers_sent()) {
         return false;
     }
     $url = HTTP::absoluteURI($url);
     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:BackupTheBerlios,项目名称:smart-svn,代码行数:31,代码来源:HTTP.php

示例4: fatal

 /**
  * Application fatal errors
  *
  * Log an error message and quits the application. This is done by
  * redirecting the user agent to a special page.
  *
  * @param string $message A custom message
  */
 public static function fatal($message)
 {
     debug_print_backtrace();
     flush();
     TIP::log('FATAL', $message);
     $fatal_uri = HTTP::absoluteURI(TIP_Application::getGlobal('fatal_uri'));
     if ($fatal_uri == $_SERVER['REQUEST_URI']) {
         // This is a recursive redirection
         HTTP::redirect('/fatal.html');
     } else {
         // This is the first redirection
         HTTP::redirect($fatal_uri);
     }
     exit;
 }
开发者ID:BackupTheBerlios,项目名称:tip,代码行数:23,代码来源:TIP.php


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