What is the `` operator in php used for?

WBOY
Release: 2016-08-04 09:21:05
Original
2073 people have browsed it

What is the `` operator in php used for?

Reply content:

What is the `` operator in php used for?

The above content is representative of garbage translation.
Shell is used directly as a professional term and should not be translated into shell, which will increase misunderstandings...


The contents in

`` are executed as shell commands

Just take the above example

<code><?php
$a =`ls -al`;
var_dump($a);
</code>
Copy after login

After running it, the contents of the current folder will be displayed

Please read the official PHP documentation, it is more useful than reading a book. Best to watch online. I give the same advice to novices.

The document address corresponding to your question is http://php.net/manual/zh/language.operators.execution.php

Everything you need is available. The examples are also very clear. If the examples are not clear, there will often be very clear examples in the user comments below (most of the examples sent by users are in English, and the others are basically translated)

Execute shell_exec command, high-risk function, it is recommended to turn it off
Reference: http://www.yunxi365.cn/index.php/archives/10/

`` Same function as shell_exec();

<code>可以运行linux命令.并返回输出;</code>
Copy after login

is a high-risk function!

<code>Shell:
pidstat -p `pidof firefox`</code>
Copy after login

PHP can also use backticks` or shell_exec to call system commands just like Shell.
In MySQL, when the database name/table name/field name conflicts with a reserved word (keyword), use backtick in the SQL statement. Use apostrophes (`) to separate them.

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