Home > Article > Backend Development > BUG and correction of fgetss_PHP tutorial
/*
Author: Zhu Jiang zhu_jiang@263.net
Graduated from Beijing University of Technology
Working, haha, let’s not talk about it, it’s a place I’m not proud of
The fgetss() function provided by the php4.
Regarding the BUG of fgetss, you can use the following code to study it:
$fp=fopen("index.html","r");
while (! feof($fp))
{
$ms=fgetss($fp);
printf($ms);
}
fclose($fp);
Version: Free
* /
function mygets($myFile)
{
//while(!feof($myFile))
//{
$myline = fgets($myFile, 255);
$big=strlen(strstr($myline,">"));
$small=strlen(strstr($myline,"if($big>$small) //This sentence is very important. It is useful if there is a line break in the middle of the HTML code{ //It is useful if > appears first in a line instead of $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;