Skip to content

v4 input instance

Inhere edited this page Oct 20, 2021 · 2 revisions

V4 Input 输入对象

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:");

Clone this wiki locally
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy