0

I create a php file containing the following codes:

<?php
print_r ($_GET);
?>

And I make a request from browser:

http://localhost/Study/php/get.php?test=1,+

I got the following message:

Array ( [test] => 1, )

the plus "+" is missing, but when i use minus "-" instead of plus "+" it's ok.

http://localhost/Study/php/get.php?test=1,-

generate the following message:

Array ( [test] => 1,- )

I use lighttpd with php.

2
  • 1
    The plus sign is a special character in urls: It represents a space.
    – matthias
    Oct 19, 2012 at 8:49
  • 1
    + is an alias of %20 which is a space. Use %2B instead of + to if you want to represent a plus character.
    – Ultimater
    Oct 19, 2012 at 8:52

1 Answer 1

2

The plus sign is a special character in urls: It represents a space. Use the appropriate variant that uses url encoding:

http://localhost/Study/php/get.php?test=1,%2B

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.