Clearing _POST array fully

前端 未结 6 996
面向向阳花
面向向阳花 2020-12-05 10:17

I want clear $_POST array content fully, all examples what I see in internet, looks like this:

if (count($_POST) > 0) {
    foreach ($_POST as $k=>$v)          


        
6条回答
  •  鱼传尺愫
    2020-12-05 10:19

    You can use a combination of both unset() and initialization:

    unset($_POST);
    $_POST = array();
    

    Or in a single statement:

    unset($_POST) ? $_POST = array() : $_POST = array();
    

    But what is the reason you want to do this?

提交回复
热议问题