posix_isatty() - posix函数(可移植操作系统接口)
posix_isatty()
(PHP 4, PHP 5, PHP 7)
Determine if a file descriptor is an interactive terminal
说明
posix_isatty(mixed $fd): boolDetermines if the file descriptor$fdrefers to a valid terminal type device.
参数
$fdThe file descriptor, which is expected to be either a file resource or an integer. An integer will be assumed to be a file descriptor that can be passed directly to the underlying system call.
In almost all cases, you will want to provide a file resource.
返回值
Returns TRUE
if$fdis an open descriptor connected to a terminal and FALSE
otherwise.
参见
posix_ttyname()
Determine terminal device namestream_isatty()
Check if a stream is a TTY
Can be useful to determine whether output is being piped elsewhere, for PHP shell scripts, for example; #!/usr/local/bin/php If this script is like: script.php > outfile outfile will contain "Invalid TTY"
鹏仔微信 15129739599 鹏仔QQ344225443 鹏仔前端 pjxi.com 共享博客 sharedbk.com
图片声明:本站部分配图来自网络。本站只作为美观性配图使用,无任何非法侵犯第三方意图,一切解释权归图片著作权方,本站不承担任何责任。如有恶意碰瓷者,必当奉陪到底严惩不贷!