php GET变量为空[关闭]

I am trying to send a value in the url when I make a GET request. When I run the get.php file, the file data.txt is created but it is empty. The GET['lat'] has no value . Why does it have no value?

update.php

<?php

if($_SERVER['REQUEST_METHOD']=='GET' )
{

$q= $GET['lat'];
file_put_contents("data.txt",$q );
}

?>

get.php

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_RETURNTRANSFER => 1,
    CURLOPT_URL => 'http://www.myurl.com/update.php?lat=1234',
    CURLOPT_USERAGENT => 'Codular Sample cURL Request'
));

$resp = curl_exec($curl);
curl_close($curl);



?>

$GET should be $_GET since it is a superglobal. That is the actual name of the get parameters array.

Reference: