Timeline for How to pass argument to php file using a drush command?
Current License: CC BY-SA 3.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Sep 16, 2016 at 13:38 | comment | added | Vlad Moyseenko |
Just as summary of all previous answers and practical example as also as answer to the question above. You can run something like this: drush scr path/to/script --id=15 . And then if your script starts with #!/usr/bin/env drush (as @greg_1_anderson mentioned) than you can get your parameter via $id = drush_get_option('id'); inside this script.
|
|
Dec 10, 2015 at 9:55 | comment | added | Guru | can u provide sample command? | |
Dec 10, 2015 at 9:09 | comment | added | ROOT | The drush command is: Drush scr.There is a way to make Drush compatible by adding in the script file header #!/usr/bin/env drush and use $arg = drush_shift() to get the arguments as an array | |
Dec 10, 2015 at 9:01 | comment | added | Guru | what is the drush command? | |
Dec 10, 2015 at 8:58 | history | answered | ROOT | CC BY-SA 3.0 |