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


PHP fURL::convertGetToPath方法代碼示例

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


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

示例1: renderURL


//.........這裏部分代碼省略.........
    /**
     * trim first ampersand
     */
    if (strpos($_vars, '&') === 0) {
        $_vars = substr($_vars, 1, strlen($_vars) - 1);
    }
    /**
     * Render new get-tokens
     */
    $ReceivedTokens = array();
    $r_TokenStrs = explode('&', $_vars);
    $widgets_token = false;
    foreach ($r_TokenStrs as $TokenStr) {
        $r_Token = explode('=', $TokenStr, 2);
        if ($r_Token[0] == 'widgets') {
            $widgets_token = true;
        }
        if ($r_Token[0] == 'store_mode') {
            $mode_token = true;
        }
        if (isset($r_Token[1]) && strlen($r_Token[1])) {
            $ReceivedTokens[$r_Token[0]] = $r_Token[1];
            if ($Mode == URLRENDMODE_MODIFY) {
                $GetVars[$r_Token[0]] = $r_Token[1];
            }
        } else {
            switch ($Mode) {
                case URLRENDMODE_MODIFY:
                    if (isset($GetVars[$r_Token[0]])) {
                        unset($GetVars[$r_Token[0]]);
                    }
                    break;
                case URLRENDMODE_RESET:
                    if (isset($GetVars[$r_Token[0]]) && $r_Token[0] != 'product_slug' && $r_Token[0] != 'category_slug') {
                        $ReceivedTokens[$r_Token[0]] = $GetVars[$r_Token[0]];
                    }
                    break;
            }
        }
    }
    /**
     * Render URL
     */
    $newGetVars = array();
    switch ($Mode) {
        case URLRENDMODE_MODIFY:
            $newGetVars =& $GetVars;
            break;
        case URLRENDMODE_RESET:
            $newGetVars =& $ReceivedTokens;
            break;
    }
    if (!$mode_token) {
        $Register =& Register::getInstance();
        if ($store_mode = $Register->get('store_mode')) {
            $newGetVars['store_mode'] = $store_mode;
        }
    }
    if (!MOD_REWRITE_SUPPORT) {
        foreach (array('product_slug', 'category_slug') as $param) {
            if (isset($newGetVars[$param])) {
                unset($newGetVars[$param]);
            }
        }
    }
    if (!$widgets_token && count($newGetVars)) {
        $Register =& Register::getInstance();
        /*@var $Register Register*/
        if ($Register->get('widgets')) {
            $newGetVars['widgets'] = 1;
        }
    }
    if ($_store) {
        $_GET = $newGetVars;
    }
    if (class_exists('fURL') && $furl !== false) {
        fURL::convertGetToPath($_request, $newGetVars);
    }
    foreach ($newGetVars as $TokenName => $TokenValue) {
        $newGetVars[$TokenName] = $TokenName . '=' . $TokenValue;
    }
    $RenderedURL = implode('&', $newGetVars);
    if (strpos($_request, '?') !== false) {
        $RenderedURL = preg_replace('/\\?.*$/', '?' . $RenderedURL, $_request);
    } else {
        $RenderedURL = $_request . '?' . $RenderedURL;
    }
    $RenderedURL = preg_replace('@[\\?\\&]{1,2}$@', '', $RenderedURL);
    $RenderedURL = preg_replace('@^/{2,}@', '/', $RenderedURL);
    if (strlen($anchor) > 1) {
        $RenderedURL = preg_replace('@#[^#]*$@', '', $RenderedURL) . $anchor;
    }
    /**
     * Strore URL
     */
    if ($_store) {
        //		$_SERVER['REQUEST_URI'] = $RenderedURL;
    }
    return $RenderedURL;
}
開發者ID:max-severin,項目名稱:sample_products,代碼行數:101,代碼來源:functions.php


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