PHP Remove JavaScript

前端 未结 7 1691
梦谈多话
梦谈多话 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 08:08

    In your case you could regard the string as a list of newline delimited strings and remove the lines containing the script tags(first & second to last) and you wouldn't even need regular expressions.

    Though if what you are trying to do is preventing XSS it might not be sufficient to only remove script tags.

提交回复
热议问题