php - check if $_POST is array?

前端 未结 8 644
独厮守ぢ
独厮守ぢ 2020-12-21 14:58

I know this may be a silly question, but I come across a snippet of php code that check if the $_POST is_array() before execute other functions.

8条回答
  •  一整个雨季
    2020-12-21 15:17

    • $_POST is a superglobal and is always defined (always exists) and is always an array
    • this is true, even if it doesn't contain any elements
    • it is possible though, if not advisable and I've never seen it, to overwrite or unset it
    • you don't need isset() and is_array() for the $_POST array but you will quite often need them for elements in the $_POST array

提交回复
热议问题