dot in variable name

前端 未结 3 2003
梦如初夏
梦如初夏 2020-12-18 00:47

I am passing the variable with dot in query string.Php is replacing the dot with under score. So how can i retain the variable name which is having dot in the name

h

3条回答
  •  清酒与你
    2020-12-18 01:04

    Use $_SERVER['QUERY_STRING']

    $get = array();
    foreach(explode('&', $_SERVER['QUERY_STRING']) as $part)
        {
        $part = explode('=', $part);
        if($key = array_shift($part))
            {
            $get[ $key ] = implode('', $part);
            }
        }
    print_r($get);
    

    Result for your example Array ( [one.txt] => on [two.txt] => on )

提交回复
热议问题