GET[] fails to work when one parameter is missing =value?
The end of my query string looks like:
tweetpushr.php?attachments&id=20&tweetbody=Wassup%20David.%20Love%20you%20like%20a%20brutha&catid=6&catid2=6&catid3=10&dtpub=0000-00-00%2000开发者_开发问答:00:00&dtpush=0000-00-00%2000:00:00&usrpush=&id=20&tweetbody=Just%20a%20little%20more%20CSS%20and%20some%20polish%20man.&catid=8&catid2=1&catid3=1&dtpub=0000-00-00%2000:00:00&dtpush=0000-00-00%2000:00:00&usrpush=
I am trying to use $_GET['tweetbody']
to access it variable but it looks as if the attachments modifier does not have an =
and is preventing me from getting the variable.
How do I get the value for tweetbody?
There is no reason that the missing =
from attachments
would prevent you from getting at any of the rest of the variables. The attachments
item will simply be populated with an empty string, and the rest of the variables will be parsed normally. Just try a script with <?php var_dump($_GET); ?>
in it and pass the string above and you will see that all keys/values appear as you would expect them to.
However, the tweetbody
key appears twice in the query string (as do most other keys) - is this the reason it doesn't have the value you expect it to?
You are sending "tweetbody" twice... I think you should rewrite your querystring using [] after the variable names (so you can read them as an array), or better send it encoded as JSON or something like that.
精彩评论