gpt4 book ai didi

php - PHP 7.1+ Windows readline扩展并非所有功能都存在

转载 作者:行者123 更新时间:2023-12-03 11:12:45 25 4
gpt4 key购买 nike

PHP7.1的一项改进是,在Windows中可以立即使用readline扩展。我在使用所有功能时遇到了麻烦,因为它们并不全部存在。如下代码:

$functions = [
'readline_add_history',
'readline_callback_handler_install',
'readline_callback_handler_remove',
'readline_callback_read_char',
'readline_clear_history',
'readline_completion_function',
'readline_info',
'readline_list_history',
'readline_on_new_line',
'readline_read_history',
'readline_redisplay',
'readline_write_history',
'readline'
];
foreach($functions as $function) {
echo $function . (function_exists($function) ? ' exists' : ' does not exist') . PHP_EOL;
}

...产生以下输出:
readline_add_history exists
readline_callback_handler_install does not exist
readline_callback_handler_remove does not exist
readline_callback_read_char does not exist
readline_clear_history exists
readline_completion_function exists
readline_info exists
readline_list_history does not exist
readline_on_new_line does not exist
readline_read_history exists
readline_redisplay does not exist
readline_write_history exists
readline exists

我在 PHP manual中找不到任何引用,表明Windows仅提供readline扩展功能的一部分。

当我调用 php_info()时,得到以下输出:

readline

Readline Support enabled

Readline library WinEditLine



为了使所有功能可用,是否需要进行一些php.ini配置设置(或CLI参数)?另外,还有其他方法可以使诸如 readline_callback_handler_install()之类的功能在Windows中可用,还是该扩展名只是半熟而已?

最佳答案

最初,我认为您可能已经陷入了缺少这些功能的古老PHP 5.0中,但是失败了,我不得不猜测您的PHP二进制文件是针对不支持该功能的基础库[或其版本]编译的这些功能所依赖的功能。

交叉引用 ext/readline/readline.c 缺少的功能列表,我想您可能缺少对应于 HAVE_RL_CALLBACK_READ_CHAR 中定义的常量/功能HAVE_LIBEDIText/readline/config.m4的功能。

TL; DR:编译您的PHP的人都需要弄清楚。 [大概]

关于php - PHP 7.1+ Windows readline扩展并非所有功能都存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50183453/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com