curl_getinfo()返回的total_time:总耗时如何取消取整?

第一次发问题,请赐教。
自学php中,代码来自《php学习手册》

$c=curl_init('http://api.example.com');
curl_setopt($c,CURLOPT_RETURNTRANSFER,true);
$result=curl_exec($c);
$info=curl_getinfo($c);

if($result===false){
    print "Error #".curl_errno($c)."<br/>";
    print "Uh-oh!cURL says:".curl_error($c)."<br/>";
}
else if($info['http_code']>=400){
    print "The server says HTTP error{$info['http_code']}.<br/>";
}

else{
    print "A successful result!<br>";
}
print "By the way,this request took {$info['total_time']} secondes.<br/>";

原书返回的$info['total_time']结果是0.000146浮点数,而我返回的是整数0

By the way,this request took 0 secondes.

请问如何能取消取整,得到与原书类似的浮点数结果?

阅读 1.9k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题