nima nima - 2 months ago 6x
PHP Question

how ca I get variable from ubuntu and insert it to the php file

I have a php file and I want get exact variable from ubuntu command line

how can I do it?


Probably, you want to pass the arguments from the command line as follows:

php /path/to/www/path/to/script.php arg1 arg2

In PHP script, you can access the variables as follows.

// $argv[0] is '/path/to/wwwpublic/path/to/script.php'
$argument1 = $argv[1];
$argument2 = $argv[2];

Please let me know your thoughts.