php_uname() 有多快?说做 php_uname('s n')
或 php_uname('a')
。我问的原因是因为我想用它来确定我在哪个服务器上,从而确定配置(路径等)。
这与 Is there a PHP function or variable giving the local host name? 有关
最佳答案
我刚刚这样做了:
<?php
$tstart = microtime(true);
php_uname('a');
print 'it took '. sprintf("%f",microtime(true) - $tstart) ." seconds\n";
?>
它产生了这个:
it took 0.000016 seconds
那是在 Core2Duo 2.4GHz Debian 机器上。
我知道这是一个实证测试,但我认为它表明它对您来说足够快。
没想到会花很长时间,因为uname只需要对内核进行一次非常简单的调用。
关于php - php_uname() 有多快?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/217555/