CLI mode is actually the command line running mode, the full English name is Command-Line Interface (Command Line Interface)
Advantages and usage occasions of PHP-CLI mode: (Recommended learning: PHP video tutorial)
1. Fully supports multi-threading
2. As above, scheduled tasks can be implemented
3. To develop desktop applications is to use PHP-CLI and GTK packages
4. Use php to write shell scripts under Linux
Run PHP in interactive shell mode
Interactive shell mode saves the entered historical commands and can be accessed using the up and down keys. The history is saved in the ~/.php_history file.
$ php -a Interactive shell php > echo 5+8; 13 php > function addTwo($n) php > { php { return $n + 2; php { } php > var_dump(addtwo(2)); int(4)
The above is the detailed content of What is the use of php cli mode?. For more information, please follow other related articles on the PHP Chinese website!