Among $_REQUEST, $_GET and $_POST which one is the fastest?

后端 未结 15 2257
小鲜肉
小鲜肉 2020-11-22 05:04

Which of these code will be faster?

$temp = $_REQUEST[\'s\'];

or

if (isset($_GET[\'s\'])) {
  $temp = $_GET[\'s\'];
}
else          


        
15条回答
  •  别那么骄傲
    2020-11-22 05:48

    I would use $_POST, and $_GET because differently from $_REQUEST their content is not influenced by variables_order.
    When to use $_POST and $_GET depends on what kind of operation is being executed. An operation that changes the data handled from the server should be done through a POST request, while the other operations should be done through a GET request. To make an example, an operation that deletes a user account should not be directly executed after the user click on a link, while viewing an image can be done through a link.

提交回复
热议问题