来自命令行的PHP服务器名称 [英] PHP Server Name from Command Line
本文介绍了来自命令行的PHP服务器名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法从命令行检测运行PHP脚本的服务器的名称?
Is there a way to detect the name of the server running a PHP script from the command line?
有许多方法可以通过HTTP访问PHP。但是似乎没有办法为CLI这样做。
There are numerous ways to do this for PHP accessed via HTTP. But there does not appear to be a way to do this for CLI.
例如:
$_SERVER['SERVER_NAME']
。
推荐答案
echo php_uname("n");
请参阅 http://php.net/manual/en/function.php-uname.php
这篇关于来自命令行的PHP服务器名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文