GNU Readline
简介
readline 扩展函数实现了访问 GNU Readline 库的接口。这些函数提供了可编辑的命令行。一个例子是在 Bash 中允许使用箭头按键来插入字符或者翻看历史命令。因为这个库的交互特性,对编写 Web 应用程序没多大用处,但当编写从命令行使用的脚本时非常有用.
从 PHP 7.1.0 开始,该扩展支持 Windows。
警告
readline 扩展并非线程安全!因此,强烈建议不要在任何真正线程安全的 SAPI(例如 Apache 的 mod_winnt)中使用这个扩展!
- 安装/配置
- 预定义常量
- Readline 函数
- readline — 读取一行
- readline_add_history — 添加一行到历史
- readline_callback_handler_install — 初始化 readline 回调接口和终端,然后打印提示并立即返回
- readline_callback_handler_remove — 移除之前已安装的回调函数句柄并且恢复终端设置
- readline_callback_read_char — 当一个行被接收时读取一个字符并且通知 readline 回调接口
- readline_clear_history — 清除历史
- readline_completion_function — 注册完成函数
- readline_info — 获取/设置各种 readline 内部变量
- readline_list_history — 获取历史
- readline_on_new_line — 通知 readline 将光标移动到新行
- readline_read_history — 读取历史
- readline_redisplay — 重绘显示区
- readline_write_history — 写入历史记录
来源:PHP Documentation Group · 作者与贡献记录 · CC BY 3.0。离线整理了版式、链接和媒体显示。
