/*
作者:朱江 zhu_jiang@263.net
毕业于北京工业大学
工作嘛,呵呵,不说也罢,那是一个并不让我引以为荣的地方
php4.X的系统所提供的fgetss()功能不完善,不能滤干净HTML TAG,分析
其中忽略了某些情况,以下代码是本人在开发过程中自制的土炮。
关于fgetss的BUG,可用如下代码研究一下:
$fp=fopen("index.html","r");
while (! feof($fp))
{
$ms=fgetss($fp);
printf($ms);
}
fclose($fp);
版杈 :免费
*/
function mygets($myFile)
{
//while(!feof($myFile))
//{
$myline = fgets($myFile, 255);
$big=strlen(strstr($myline,">"));
$small=strlen(strstr($myline,"if($big>$small) //此句很重要,如果HTML代码中间有换行时有用
{ //如果一行中首先出现的是>而不是$myline=strstr($myline,">");
$myline=substr($myline,1);
}
$len=strlen($myline);
$startskip=false;
$outstring=""; //important!
for($i=1;$i{
$a=substr($myline,$i-1,1);
switch($a)
{
case "$startskip=true;
//$myline=substr($myline,">");
//$myline=strstr($myline,1);
break;
case ">":
//$myline=substr($myline,1);
$startskip=false;
break;
default:
}
if(!$startskip && $a!=">") $outstring=$outstring.$a;
}
$outstring=str_replace(" "," ",$outstring);
//当然,以&开头的东东如果不想要可以再加,如法炮制,这里只是过滤
$outstring=str_replace(" ","",$outstring);
$outstring=str_replace(" ","",$outstring); //双引号内为全角空格
$outstring=str_replace(" ","",$outstring);
return $outstring;
//}
} ?>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Dreamweaver Mac version
Visual web development tools

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Dreamweaver CS6
Visual web development tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.
