Warning: in_array() expects parameter 2 to be array, null given

前端 未结 4 1703
悲&欢浪女
悲&欢浪女 2021-01-27 03:47

I am getting the following warning when trying to add data to a session (and checking if it already exists).

Warning: in_array() expects parameter 2 to be

4条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-27 04:26

    you should always apply check for array

    isset( $_SESSION['product']) in your is condition before & condition 
    

提交回复
热议问题