使用php怎么实现一个网页病毒清除类

介绍

这期内容当中小编将会给大家带来有关使用php怎么实现一个网页病毒清除类,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。

php有什么用

php是一个嵌套的缩写名称,是英文超级文本预处理语言,它的语法混合了C、Java、Perl以及php自创新的语法,主要用来做网站开发,许多小型网站都用php开发,因为php是开源的,从而使php经得久不衰。

首先们要读取美元checkFile文件这个文章是判断一个文章是否被感染了,如果是就会执行savafile美元变量里面的txt文件路径的所有文件,进行按你infecFile病毒列表清除一次。

代码如下:

& lt; ?php
,类clear_virus {
,//公共美元内容;
,公共$ infectFile=& # 39; virus.txt& # 39;;//病毒文件列表文件
,公共savefile 美元;,,=皊ave.txt"//所在查看病毒的文件列表
,公共timep 美元;=& # 39;time.txt& # 39;;//些记录清除病毒时间
,公共$ checkFile=& # 39; e.php& # 39;;//这里是设置
,公共run 美元,=0;
,公共virus_type美元;
,公共replace 美元;;
,公共filepath;美元,
,公共tag 美元;,,,,,,,=0,,
,,,
,函数open_file () {
,,$ this→read_virus (),,,,
,,$ this→check_File ();
,,如果($ this→运行){,
,,,$ this→update_time (),,
,,,$ this→read_file (),,,,,
,,,foreach ($ this→filepath tmppath美元){
,,,,如果(file_exists (tmppath美元)){
,,,,,tmp_file=file_get_contents (tmppath美元);美元,
,,,,,print_r ($ this→virus_type);,,,,,,
,,,,,,,(我=0;i<美元;sizeof ($ this→virus_type);美元我+ +){
,,,,,,,,如果(大小写敏感(tmp_file美元,美元这→virus_type [$ i]) !==false) {
,,,,,,,,,(tmp_file=str_replace美元这→virus_type [$ i], & # 39; & # 39;, tmp_file美元);
,,,,,,,,,$ this→标签=1,,,,,,,,,,,
,,,,,,,,},,,,,,,,,
,,,,,,,}
,,,,,,,如果($ this→标签){
,,,,,,,,$处理=fopen (tmppath美元,& # 39;w # 39;);
,,,,,,,,写入文件(手柄,tmp_file美元);
,,,,,,,,文件关闭($处理);
,,,,,,,,设置(tmp_file美元),,
,,,,,,,},,,,,
,,,,,,
,,,,其他}{
,,,,,;
,,,,},,,,,,
,,,},
,,}
,}
,,
,函数check_File () {
,,如果(file_exists ($ this→checkFile)) {
,,,$ temp=file_get_contents ($ this→checkFile);
,,,echo $温度;
,,,,foreach ($ this→virus_type v_tmp美元){
,,,,,如果(大小写敏感(temp, v_tmp美元)!==false) {
,,,,,,这→美元=1;
,,,,,,打破;
,,,,,}
,,,,}
,,,,echo $ this→运行;
,,,,设置(临时);,,,,
,,其他}{
,,,$ this→show_error (5);
,,}
,}
,,
,函数update_time () {
,,如果(file_exists ($ this→timep)) {
,,,$ tmp_time=日期(“Y-m-d H:我:s") .chr(13) # 39;公司| & # 39;;
,,,tmp_fp 美元;=fopen ($ this→timep, & # 39; a + & # 39;);
,,,写入文件(tmp_fp, tmp_time美元);
,,,文件关闭($ tmp_fp);,,,,
,,}
,,,
,}
,,
,,
,read_File()函数{,,
,,如果(file_exists ($ this→savefile)) {,,
,,,=$ this→内容文件($ this→savefile),,,,,
,,,如果(is_array ($ this→内容)){,,,
,,,,$ this→filepath=$这→内容;,,,,,
,,,其他}{
,,,,$ this→show_error (3);
,,,}
,,其他}{
,,,$ this→show_error (4);
,,},
,}
,,
,,
,函数read_virus () {,,
,,如果(file_exists ($ this→infectFile)) {,,null

使用php怎么实现一个网页病毒清除类