Console_Getopt::getopt -- fetch the command-line options Описание
Parses the command-line options and returns them.
Параметр
array $args - an array of command-line arguments
string $shortoptions - specifies the list of allowed
short options. See the "Options" section
for more information.
array $longoptions - specifies the list of allowed
long options. Default is NULL. See the "Options" section
for more information.
Возвращаемое значение
array - two-element array containing the list of
parsed options and the non-option arguments or a PEAR_Error.
Throws
Таблица 21-1. Возможные значения PEAR_Error Error code | Error message | Reason | Solution |
---|
NULL |
"Console_Getopt: option --$opt is ambiguous"
|
Two or more long options starts with the same character.
|
Change the naming of the options. It is also possible that
the error is caused by a typing mistake.
| NULL |
"Console_Getopt: option --$opt requires an argument"
|
No parameter for a option was given.
|
Normally this is a user mistake. If the parameter is optional,
you have to markup the parameter as optional in the option
definitions.
| NULL |
"Console_Getopt: option --$opt doesn't allow an argument"
|
A parameter for a option was given.
|
Normally this is a user mistake. If the option requires a
(optional) parameter, you have to markup it in the options
definition.
| NULL |
"Console_Getopt: unrecognized option
--$opt"
|
Unknown option.
|
Normally this is a user mistake. If the option exists, you
have to define them in the options definition.
|
ЗаметкаЭта функция не должна вызываться статически.
|