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


PHP eZHTTPTool::headerVariable方法代码示例

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


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

示例1: redirect

 /**
  * \static
  * Performs an HTTP redirect.
  *
  * \param  $path  The path to redirect
  * \param  $parameters  \see createRedirectUrl()
  * \param  $status  The HTTP status code as a string
  * \param  $encodeURL  Encode the URL. This should normally be true, but
  * may be set to false to avoid double encoding when redirect() is called
  * twice.
  */
 static function redirect($path, $parameters = array(), $status = false, $encodeURL = true)
 {
     $url = eZHTTPTool::createRedirectUrl($path, $parameters);
     if (strlen($status) > 0) {
         header($_SERVER['SERVER_PROTOCOL'] . " " . $status);
         eZHTTPTool::headerVariable("Status", $status);
     }
     if ($encodeURL) {
         $url = eZURI::encodeURL($url);
     }
     eZHTTPTool::headerVariable('Location', $url);
     /* Fix for redirecting using workflows and apache 2 */
     echo '<HTML><HEAD>';
     echo '<META HTTP-EQUIV="Refresh" Content="0;URL=' . htmlspecialchars($url) . '">';
     echo '<META HTTP-EQUIV="Location" Content="' . htmlspecialchars($url) . '">';
     echo '</HEAD><BODY></BODY></HTML>';
 }
开发者ID:,项目名称:,代码行数:28,代码来源:

示例2: redirect

    /**
     * Performs an HTTP redirect.
     *
     * @param string $path The path to redirect to
     * @param array $parameters See createRedirectUrl(). Defaults to empty array.
     * @param bool $status The HTTP status code as a string (code + text, e.g. "302 Found"). Defaults to false.
     * @param bool $encodeURL Encodes the URL.
     *                        This should normally be true, but may be set to false to avoid double encoding when redirect() is called twice.
     *                        Defaults to true
     * @param bool $returnRedirectObject If true, will return an ezpKernelRedirect object.
     *
     * @return null|ezpKernelRedirect
     */
    static function redirect($path, $parameters = array(), $status = false, $encodeURL = true, $returnRedirectObject = false)
    {
        $url = eZHTTPTool::createRedirectUrl($path, $parameters);
        if (strlen($status) > 0) {
            header($_SERVER['SERVER_PROTOCOL'] . " " . $status);
            eZHTTPTool::headerVariable("Status", $status);
        }
        if ($encodeURL) {
            $url = eZURI::encodeURL($url);
        }
        eZHTTPTool::headerVariable('Location', $url);
        /* Fix for redirecting using workflows and apache 2 */
        $escapedUrl = htmlspecialchars($url);
        $content = <<<EOT
<HTML><HEAD>
<META HTTP-EQUIV="Refresh" Content="0;URL={$escapedUrl}">
<META HTTP-EQUIV="Location" Content="{$escapedUrl}">
</HEAD><BODY></BODY></HTML>
EOT;
        if ($returnRedirectObject) {
            return new ezpKernelRedirect($url, $status ?: null, $content);
        }
        echo $content;
    }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:37,代码来源:ezhttptool.php


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