使用$
使用$ _GET在Querystring中只读参数名称(Read only parameter name in Querystring with $_GET)我怎样才能从PHP中的查询字符串读取参数名称? 例如在这两个方面:
www.example.com/index.php?a='1'www.example.com/index.php?a想要的输出是:
aHow can I read only the parameter name from a querystring in PHP? For example in both of these:
www.example.com/index.php?a='1'www.example.com/index.php?athe wanted output is:
a 最满意答案您可以使用全局$ _GET数组的array_keys :
$keys = array_keys($_GET);echo $keys[0]; // echos aYou can use the array_keys of the global $_GET array:
$keys = array_keys($_GET);echo $keys[0]; // echos a