Pass a value into filter_input() using variable

前端 未结 3 1192
一向
一向 2021-01-21 23:24

Can anyone please explain, why do I get very strange warning:

filter_input() expects parameter 1 to be long, string given

when executing the co

3条回答
  •  闹比i
    闹比i (楼主)
    2021-01-22 00:12

    Here the problem. When you concatenate 'INPUT_' with variable it bacame a string, see example:

    echo $type = 'INPUT_' . 'POST'; // give you a string INPUT_POST
    
    echo INPUT_POST; //give you 0
    

    That's why :

    filter_input() expects parameter 1 to be long, string given
    

提交回复
热议问题