例如,php_uname()做php_uname('s n')或php_uname('a')的速度有多快。我问的原因是因为我想用它来确定我在哪台服务器上,从而确定配置(路径等)。
这与Is there a PHP function or variable giving the local host name?相关
发布于 2008-10-20 05:12:37
我就这么做了:
<?php
$tstart = microtime(true);
php_uname('a');
print 'it took '. sprintf("%f",microtime(true) - $tstart) ." seconds\n";
?>它产生了这个结果:
it took 0.000016 seconds这是在Core2Duo 2.4 box的Debian机器上实现的。
我知道这是一个实证测试,但我认为这表明它对你来说已经足够快了。
我没想到会花很长时间,因为uname只需要对内核进行一个非常简单的调用。
发布于 2008-10-23 10:06:32
$_SERVER['HTTP_HOST']https://stackoverflow.com/questions/217555
复制相似问题