readline
(PHP 4, PHP 5, PHP 7, PHP 8)
readline — 讀取一行
參數
-
prompt
-
你可以指定一個字串來作為使用者的提示資訊
返回值
從使用者端返回一個行字串.返回的該行的行尾換行符會被刪除
範例
示例 #1 readline() Example
<?php
//get 3 commands from user
for ($i=0; $i < 3; $i++) {
$line = readline("Command: ");
readline_add_history($line);
}
//dump history
print_r(readline_list_history());
//dump variables
print_r(readline_info());
?>