What's wrong with using $_REQUEST[]?

后端 未结 16 1523
走了就别回头了
走了就别回头了 2020-11-22 03:53

I\'ve seen a number of posts on here saying not to use the $_REQUEST variable. I usually don\'t, but sometimes it\'s convenient. What\'s wrong with it?

16条回答
  •  难免孤独
    2020-11-22 04:05

    Just make sure to set correct parameter in your php.ini (below is default, as long as not set to GPC, no Cookies are used here)

    request_order = "GP"
    

    which means POST overwrites GET and you'll be fine.

    The reason for $_REQUEST is simply consolidation of $_GET and $_POST. When sending a form and navigation through lots of links on your page, it is very usefull to have one place which holds the state: $_REQUEST

提交回复
热议问题