略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: readline_add_history

2024-11-14

readline_add_history

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

readline_add_history添加一行命令行历史记录

说明

readline_add_history(string $line): bool

这个函数添加一行到命令行历史记录 This function adds a line to the command line history.

参数

line

这一行将被添加到历史.

返回值

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

add a noteadd a note

User Contributed Notes 1 note

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

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

官方地址:https://www.php.net/manual/en/function.readline-add-history.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3