Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use php to clear script

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report