1. php-rphpcodesparam1param22.php-ffilename.phpparam1param23.php-a4. In the php file header with php file full path such as file. php! # Usrbinphp? Phpechophpinfo (); then, add the execution permission chmod + xfile. php. file. php to file. php to execute
1. php-r php codes param1 param2 2. php-f filename. php param1 param2 3. php-a 4. Add the full php file path to the php file header, such as file. php! #/Usr/bin/php? Phpecho phpinfo (); then, add the execution permission chmod + x file. php./file. php to file. php.
1. php-r 'php Code' param1 param2...
2. php-f filename. php param1 param2...
3. php-
4. Add the full PHP file path to the PHP File Header
For example, file. php
! #/Usr/bin/php
Then add the execution permission chmod + x file. php to file. php.
./File. php can execute the php code in the file.
Original article address: several ways to execute php code using php cli sapi. Thank you for sharing with me.