I have been trying to figure out why some of my shell scripts alternate between using the parser option. Some list the PHP command like this:
php -f indexer.php
While other just use:
php indexer.php
I did a series of tests trying to see if the results varied based on PHP functionality but I haven't been able to see a difference.
The documentation states " The -f is optional and may be omitted - providing just the filename to execute is sufficient. "
http://php.net/manual/en/features.commandline.options.php
So when would you use it?
About the only useful purpose for -f
is to explicitly indicate which of the command line args is the script to be executed:
php foo.php bar.php
While PHP would execute the FIRST filename encountered on the command line and leave the rest as arguments for that first script, putting it as
php -f foo.php bar.php
makes it that wee little bit more obvious.
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.