简体   繁体   中英

php CLI arguments Issues

I'm working on a command-line script for a php app.

I can't get it to successfully accept params.

(via ssh)
If I type:
/: php testFile.php arg1 arg2 arg3

I receive the following errors: Notice: Undefined variable: agrc in /testFile.php on line 3 Notice: Undefined variable: agrv in /testFile.php on line 3

Here's the current code:

<?php
echo ini_get('register_argc_argv');
print_r( $agrc );print_r( $agrv );
?>

I also confirmed that the 'register_argc_argv' directive is TRUE

What am I over looking ?

Thanks in advance.

使用$_SERVER['argv']代替$agrv

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM