Re: undefined $_GET index.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



atar wrote:

> I've written the following code:
> 
>> <?php
>> var_dump($_GET['r']);
>> ?>
> 
> and save it to a file named: test.php.
> Afterwards, I've launch the PHP binary on my Debian Linux machine with
> the following line:
> 
>> "php -S 127.0.0.1:8000 test.php"
> 
> in order to use the built-in PHP web server.
> then, I've fired up my browser and enter the following in the location bar:
> 
>> "http://127.0.0.1:8000/test.php?r=something";
> 
> The PHP built-in web server responded in the terminal as followed:
> 
>> "[Tue Dec 24 23:56:31 2013] PHP Notice:  Undefined index: r in
>> /home/user/Desktop/new_raf_jewl/test.php on line 3"
> 
> My question is simply why? what's wrong with my above PHP snippet? and
> the strange thing here is that the PHP binary replies to the browser
> with the following:
> 
>> " string(9) "something" "
> 
> so what's going here? is the $_GET['r'] index is defined or not?
> 
> NOTE: I'm using the php-cli (Command Line Interface) version of the PHP
> binary.

Um, the command line for starting the built-in webserver seems wrong.
According to the documentation[1], test.php is used as router script,
what is probably not intended.  Just try to start the server without the
script argument:

  php -S 127.0.0.1:8000

[1]
<http://www.php.net/manual/en/features.commandline.webserver.php#example-383>

-- 
Christoph M. Becker

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux