How to use php to clear script
How to use php to clear script, many novices are not very clear about this, in order to help you solve this problem, the following small series will explain in detail for everyone, there are people who need this to learn, I hope you can gain something.
php Clear script method: 1, Create a PHP sample file;2, By "function delScript($string){...} "Method removes script from html.
Operating environment: Windows 7, PHP 7.1, DELL G3
How does PHP clear scripts?
PHP removes script from html
The code is as follows:
//remove script function delScript($string){ $pregfind = array("/.*/ siU",'/on(mousewheel|mouseover|click|load|onload|submit|focus|blur)="[^"]*"/i'); $pregreplace = array('',''); $string = preg_replace($pregfind, $pregreplace, $string); return $string;}
The main thing is to replace the middle part with empty.
Did reading the above help you? If you still want to have further understanding of related knowledge or read more related articles, please pay attention to the industry information channel, thank you for your support.