开发者

How can I use func_get_args() with PHP 5.3?

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜