I am working on a command line php file, and I tried to use func_get_args(); but I have got a warning message: Called from the global scope - no function开发者_如何学编程 context in C:\wamp\www\index.php , and it doesn't work.
Does anybody has an idea to resolve this problem?
You are probably looking for the arguments you pass with the cli call
var_dump($argv);
func_get_args()
pulls the arguments given to a function/method (thats what the leading func
means).
You need to use func_get_args()
inside a function.
Example
function yourfunc() {
//> use it here
}
//> Not here
精彩评论