一段测试你网络速度的php
<?php //$file = fopen('abc.txt','w');
//for($i=0;$i<170400;$i++) fwrite($file,'helloworld');
//fclose($file);
$data = file_get_contents('abc.txt');
$fsize = filesize("abc.txt")/1024;
$start = gettime();
echo $data;
$end = gettime();
$cs = ($end['0']+$end['1']) - ($start['0']+$start['1']);
$speed = round(($fsize / $cs),2);
echo "
network: ".$speed." KB/sec.";
function gettime()
{
return explode(" ",microtime());
}
php免费学习视频:立即使用
踏上前端学习之旅,开启通往精通之路!从前端基础到项目实战,循序渐进,一步一个脚印,迈向巅峰!










