无法从函数中的参数获取值

时间:2013-09-16 18:41:23

标签: php function get

任何人都知道为什么我不能在这里使用_GET名称参数?

它说我名字上有一个未定义的索引 这通常意味着我无法读取参数 我的网址是

/数据/内容/ DE /家/写名字= 123&安培;密码= 123

现在有点无能为力:/

if(strpos($_SERVER['REQUEST_URI'],'write?name=') !== false){
    $sUrl=array_reverse(explode('?',substr($_SERVER['REQUEST_URI'],1)));
    $sUrl=str_replace('write','',$sUrl[1]).'index.html';
    if($sUrl=='index.html'){
            $sUrl='data/content'.'/'.$language.'/'.$home.'/index.html';;
    };
    ----->>!! echo $_GET['name']; !!<-----      
}else{
    if(strpos($_SERVER['REQUEST_URI'],'write') !== false){
        $sUrl=str_replace('write','',substr($_SERVER['REQUEST_URI'],1)).'index.html';
        $login='true';
        if($sUrl=='index.html'){
            $sUrl='data/content'.'/'.$language.'/'.$home.'/index.html';;
        };
    } else {
        $sUrl=substr($_SERVER['REDIRECT_URL'],1);
    };
};

tia hvlmnns​​

修改

http://hvlmnns.de/write?name=1223&password=123 http://hvlmnns.de/write/?name=1223&password=123

经过一番争吵之后,我发现了这个问题 因为每个jquery提交表单,我认为有一种方法可以将斜杠放在那里。 奇怪的是,它不应该读取斜线是否有斜线?

1 个答案:

答案 0 :(得分:0)

你的$ _SERVER ['REQUEST_URI']评估为什么?

IIRC:查询字符串跟随?不包含在request_uri中。

尝试使用$ _SERVER ['QUERY_STRING']

相关问题