Home  >  Article  >  Backend Development  >  What is the use of php cli mode?

What is the use of php cli mode?

(*-*)浩
(*-*)浩Original
2019-10-14 13:26:234799browse

CLI mode is actually the command line running mode, the full English name is Command-Line Interface (Command Line Interface)

What is the use of php cli mode?

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn