PHP -Sanitize values of a array

前端 未结 5 921
孤城傲影
孤城傲影 2020-12-01 09:33

I have a array, which comes from $_POST[] and can have other arrays in it as values, like:

array(
 \'title\' => \'Title\',
 \'data\' => ar         


        
5条回答
  •  青春惊慌失措
    2020-12-01 10:01

    Just use the filter extension.

    /* prevent XSS. */
    $_GET   = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING);
    $_POST  = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
    

    This will sanitize your $_GET and $_POST.

提交回复
热议问题