PHP -Sanitize values of a array

前端 未结 5 924
孤城傲影
孤城傲影 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 09:55

    Let's say we want to sanitize the $_POST array:

    foreach($_POST as $k=>$v) {$_POST[$k] = htmlspecialchars($v);}

    This simple. Isn't it?

提交回复
热议问题