How to pass variable to PHP file in Shell Script

1

How can I do to pass a variable to a php file in a shell script, I'm trying to do that below, without success.

php -f complete.php?login=$1
    
asked by anonymous 20.08.2018 / 00:20

1 answer

1

There will be a $argv variable that will be an array with values passed via CLI, but not the way you did it. Just pass the value as an script argument:

$ php -f complete.php teste

So, if you make the value of $argv it will be ['teste'] .

See more in the official documentation: Array of arguments passed to the script .

    
20.08.2018 / 01:39