开发者

GET[] fails to work when one parameter is missing =value?

开发者 https://www.devze.com 2023-04-01 04:54 出处:网络
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%

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消