Рекурсивный акроним словосочетания «PHP: Hypertext Preprocessor»
Добро пожаловать на форум PHP программистов!
За последние 24 часа нас посетили 16490 программистов и 1766 роботов. Сейчас ищут 1711 программистов ...
Console_Getopt::readPHPArgv
Вернуться к: Console_Getopt
Console_Getopt::readPHPArgv
Console_Getopt::readPHPArgv – read the predefined $argv array
Synopsis
require_once 'Console/Getopt.php';
array readPHPArgv ( )
Reads the $argv PHP array across different PHP configurations. Will take care of the register_globals and register_argc_argv ini directives.
Return value
array - array containing the options and parameters or PEAR_Error
Throws
Error code | Error message | Reason | Solution |
---|---|---|---|
NULL | "Console_Getopt: Could not read cmd args (register_argc_argv=Off?)" | PHP does not provide the command-line arguments for the script. | Check "register_argc_argv" in your php.ini |
Note
This function can not be called statically.
Example
Using readPHPArgv()
<?php
$con = new Console_Getopt;
$args = $con->readPHPArgv();
array_shift($args);
$options = $con->getopt2($args, $shortopt);
?>
Вернуться к: Console_Getopt