Esempio n. 1
0
/**
 * 解析出URL地址,形如/psys/user/login
 * @param string $prjstr 子系统地址 psys,pweb
 * @param string $modstr 子系统模块
 * @param string $actstr 子系统模块Action
 */
function UrlParse(&$prjstr, &$modstr, &$actstr)
{
    //var_dump($_SERVER);
    //$t = reqarray('cnkey', array());
    //$t2 = reqstr('cntitle', '');
    //var_dump($_REQUEST);
    //exit;
    $result = XUrlParse($prjstr, $modstr, $actstr);
    if ($result) {
        return;
    }
    $uu = explode("?", $_SERVER['REQUEST_URI']);
    global $G_X;
    //$t = $_SERVER;
    if (defined("WEB_URL") && WEB_URL != '' && WEB_URL != '/') {
        $tt = trim(WEB_URL, '/');
        $uu[0] = str_ireplace($tt, '', $uu[0]);
    }
    $uu[0] = str_ireplace(array('.php', $prjstr), '', $uu[0]);
    $uu[0] = trim($uu[0], '/');
    $uu = explode("/", $uu[0]);
    if ($prjstr != '') {
        $modstr = count($uu) > 0 ? $uu[0] : "";
        $actstr = count($uu) > 1 ? $uu[1] : "";
    } else {
        list($prjstr, $modstr, $actstr) = $uu;
        $prjstr = count($uu) > 0 ? $uu[0] : "";
        $modstr = count($uu) > 1 ? $uu[1] : "";
        $actstr = count($uu) > 2 ? $uu[2] : "";
    }
    $prjstr = $prjstr == '' ? 'pc' : trim($prjstr);
    $modstr = $modstr == '' ? 'index' : trim($modstr);
    $actstr = $actstr == '' ? 'index' : trim($actstr);
}
Esempio n. 2
0
/**
 * 解析出URL地址,形如/psys/user/login
 * @param string $prjstr 子系统地址 psys,pweb
 * @param string $modstr 子系统模块
 * @param string $actstr 子系统模块Action
 */
function UrlParse(&$prjstr, &$modstr, &$actstr)
{
    //var_dump($_SERVER);
    //$t = reqarray('cnkey', array());
    //$t2 = reqstr('cntitle', '');
    //var_dump($_REQUEST);
    //exit;
    $result = XUrlParse($prjstr, $modstr, $actstr);
    if ($result) {
        return;
    }
    $uu = explode("?", $_SERVER['REQUEST_URI']);
    global $G_X;
    //$t = $_SERVER;
    if (WEB_URL != '' && WEB_URL != '/') {
        $tt = trim(WEB_URL, '/');
        $uu[0] = str_ireplace($tt, '', $uu[0]);
    }
    $uu[0] = str_ireplace(array('.php', $prjstr), '', $uu[0]);
    $uu[0] = trim($uu[0], '/');
    if ($uu[0] == '' || $prjstr == '') {
        if ($prjstr == 'pmobile') {
            $uu[0] = 'index/hot';
        }
        if ($prjstr == 'pweb' || $prjstr == '') {
            $uu[0] = 'index/hot';
        }
    }
    //if($uu[0] == '' && ($prjstr == '' || $prjstr == 'pweb'))$uu[0] = 'index/hot';
    $uu = explode("/", $uu[0]);
    if ($prjstr != '') {
        list($modstr, $actstr) = $uu;
        $param_key = @$G_X['urlparse'][$modstr][$actstr];
        if (count($uu) > 2 && !empty($param_key)) {
            $_ENV[$param_key] = $uu[2];
            $_REQUEST[$param_key] = $uu[2];
            $_POST[$param_key] = $uu[2];
            $_GET[$param_key] = $uu[2];
        }
    } else {
        list($prjstr, $modstr, $actstr) = $uu;
    }
    $prjstr = $prjstr == '' ? 'pweb' : trim($prjstr);
    $modstr = $modstr == '' ? 'index' : trim($modstr);
    $actstr = $actstr == '' ? 'index' : trim($actstr);
}