sapi_windows_vt100_support() - php 选项信息函数
sapi_windows_vt100_support()
(PHP 7 >= 7.2.0)
Get or set VT100 support for the specified stream associated to an output buffer of a Windows console.
说明
sapi_windows_vt100_support(resource $stream[,bool $enable]): boolIf$enableis omitted, the function returnsTRUE
if the stream$streamhas VT100 control codes enabled,FALSE
otherwise.
If$enableis specified, the function will try to enable or disable the VT100 features of the stream$stream. If the feature has been successfully enabled (or disabled), the function will returnTRUE
,orFALSE
otherwise.
At startup, PHP tries to enable the VT100 feature of theSTDOUT
/STDERR
streams. By the way, if those streams are redirected to a file, the VT100 features may not be enabled.
If VT100 support is enabled, it is possible to use control sequences as they are known from the VT100 terminal. They allow the modification of the terminal's output. On Windows these sequences are called Console Virtual Terminal Sequences.
WarningThis function uses theENABLE_VIRTUAL_TERMINAL_PROCESSING
flag implemented in the Windows 10 API, so the VT100 feature may not be available on older Windows versions.
参数
$streamThe stream on which the function will operate.
$enableIf specified, the VT100 feature will be enabled (ifTRUE
) or disabled (ifFALSE
).
返回值
If$enableis not specified:returnsTRUE
if the VT100 feature is enabled,FALSE
otherwise.
If$enableis specified:成功时返回TRUE
,或者在失败时返回FALSE
。
范例
Example #1sapi_windows_vt100_support()default state
By default,STDOUT
andSTDERR
have the VT100 feature enabled.
php -r "var_export(sapi_windows_vt100_support(STDOUT));echo ' ';var_export(sapi_windows_vt100_support(STDERR));"
以上例程的输出类似于:
true true
By the way, if a stream is redirected, the VT100 feature will not be enabled:
php -r "var_export(sapi_windows_vt100_support(STDOUT));echo ' ';var_export(sapi_windows_vt100_support(STDERR));" 2>NUL
以上例程的输出类似于:
true false
Example #2sapi_windows_vt100_support()changing state
You won't be able to enable the VT100 feature ofSTDOUT
orSTDERR
if the stream is redirected.
php -r "var_export(sapi_windows_vt100_support(STDOUT, true));echo ' ';var_export(sapi_windows_vt100_support(STDERR, true));" 2>NUL
以上例程的输出类似于:
true false
Example usage of VT100 support enabled
以上例程会输出:
Just forgot a letter.
鹏仔微信 15129739599 鹏仔QQ344225443 鹏仔前端 pjxi.com 共享博客 sharedbk.com
图片声明:本站部分配图来自网络。本站只作为美观性配图使用,无任何非法侵犯第三方意图,一切解释权归图片著作权方,本站不承担任何责任。如有恶意碰瓷者,必当奉陪到底严惩不贷!