您的位置:首页 > 编程语言 > PHP开发

php 测试网速

2020-04-01 12:43 806 查看

<?php
// $res = file_get_contents('1.log');

// class b{
//     function json_decode(){
//         echo '132';

//     }
// }

// $b = new b;
// $b->json_decode();
$kb=10240;

echo "streaming $kb Kb...<!-";

flush(); //刷新输出缓冲

$time = explode(" ",microtime());

$start = $time[0] + $time[1];

for($x=0;$x<$kb;$x++){

    echo str_pad('', 1024, '.');

    flush();

}

$time = explode(" ",microtime());

$finish = $time[0] + $time[1];

$deltat = $finish - $start;

echo "-> Test finished in $deltat seconds. Your speed is ". round($kb / $deltat, 3)."Kb/s";

转载于:https://my.oschina.net/u/2005502/blog/825712

  • 点赞
  • 收藏
  • 分享
  • 文章举报
chengzhe1485 发布了0 篇原创文章 · 获赞 0 · 访问量 229 私信 关注
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: