-
Notifications
You must be signed in to change notification settings - Fork 48
v4 input instance
Inhere edited this page Oct 20, 2021
·
2 revisions
v4.0+
版本之后 Input
输入对象,不再提供选项参数解析功能。仅提供基本的输入信息管理。
TIP: 选项参数解析功能由新的
FlagsParser
对象来解析和管理
echo $input->getScript(); // 'examples/app' 执行的入口脚本文件 echo $input->getFullScript(); // 命令行输入的原样字符串
echo "Your name:"; $name = $input->read(); echo 'input is ' . $name; // 'simon'
效果(in terminal):
$ Your name: simon
$ input is simon
也可以直接将消息文本放入参数 $name = $input->read("Your name:");