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

What is the use of php cli mode?

(*-*)浩
Release: 2023-02-26 15:16:01
Original
4842 people have browsed it

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)
Copy after login

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!

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template