Results of 1 - 1 of about 1 for shortopts (0.001 sec.)
- getopt — コマンドライン引数のリストからオプションを取得する | PHP 8.3 9414
- getopt (PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8) getopt — コマンドライン引数のリストからオプションを取得する 説明 function getopt ( string $short_options , array $long_options = [] , int &$rest_index = null ): array | false スクリプトに渡された
... ray(2) { ["f"]=> string(5) "value" ["h"]=> bool(false) } 例2 getopt() の例:長いオプション <?php // スクリプト example.php $shortopts = "" ; $shortopts .= "f:" ; // 値が必須 $shortopts .= "v::" ; // 値がオプション $shortopts .= "abc" ; // これらのオプション ... "required:" , // 値が必須 "optional::" , // 値がオプション "option" , // 値なし "opt" , // 値なし ); $options = getopt ( $shortopts , $longopts ); var_dump ( $options ); ?> shell> php example.php -f "value for f" -v -a --required value --optional="option ...
-
https://man.mtool.work/php/8.3/function.getopt.html
PREV
1
NEXT