readline_add_history

(PHP 4, PHP 5, PHP 7, PHP 8)

readline_add_history添加一行到历史

说明

readline_add_history(string $prompt): bool

此函数添加一行到命令行历史。

参数

prompt

添加到历史中的行。

返回值

成功时返回 true, 或者在失败时返回 false

add a note

User Contributed Notes 1 note

up
-8
Anonymous
13 years ago
Note that readline_add_history() will add empty strings too.

<?php
$line
= readline(">>> ");
if (!empty(
$line)) {
readline_add_history($line);
}
?>
To Top