PHP Remove JavaScript

前端 未结 7 1759
梦谈多话
梦谈多话 2020-12-03 07:13

I am trying to remove JavaScript from the HTML.

I can\'t get the regular expression to work with PHP; it\'s giving me an null array. Why?



        
7条回答
  •  生来不讨喜
    2020-12-03 07:57

    function clean_jscode($script_str) {
        $script_str = htmlspecialchars_decode($script_str);
        $search_arr = array('');
        $script_str = str_ireplace($search_arr, $search_arr, $script_str);
        $split_arr = explode(' $val) {
            $newarr = explode('', $split_arr[$key]);
            $remove_jscode_arr[] = ($key == 0) ? $newarr[0] : $newarr[1];
        }
        return implode('', $remove_jscode_arr);
    }
    

提交回复
热议问题