<?php
$fh=fopen("textfile.txt",'w');
for($x=0;$x<170400;$x++)
fwrite($fh,"bandwidth");
fclose($fh);
?><?php
$data=file_get_contents("textfile.txt");
$fsize=filesize('textfile.txt')/1024;
$start=time();
echo "<!-- $data -->";
$stop=time();
$duration=$stop-$start;
$speed=round($fsize/$duration,2);
echo "Your network speed :$speed KB/sec.";
?>当执行代码,警告 分母为0.
这是为什么,这段代码是那个""PHP与MYSQL......"
$fh=fopen("textfile.txt",'w');
for($x=0;$x<170400;$x++)
fwrite($fh,"bandwidth");
fclose($fh);
?><?php
$data=file_get_contents("textfile.txt");
$fsize=filesize('textfile.txt')/1024;
$start=time();
echo "<!-- $data -->";
$stop=time();
$duration=$stop-$start;
$speed=round($fsize/$duration,2);
echo "Your network speed :$speed KB/sec.";
?>当执行代码,警告 分母为0.
这是为什么,这段代码是那个""PHP与MYSQL......"
echo "<!-- $data -->";
$stop=time();因为$data很小所以 $start=$stop
<?php
$data=file_get_contents("textfile.txt");
$fsize=filesize('textfile.txt')/1024;
$start=microtime(true);
echo "<!-- $data -->";
$stop=microtime(true);
$duration=$stop-$start;
$speed=round($fsize/$duration,2);
//$speed = 10;
echo "Your network speed :$speed KB/s.";
?>