search
Homephp教程php手册PHP用反撇号执行外部命令

PHP用反撇号执行外部命令

 例如:

echo `whoami`;

// 导出数据库,要导入的文件夹必须要有可写权限, -u -p之后的内容必须要紧挨着写

 代码如下:

echo `mysqldump -h localhost -u$DbUser -p$DbPwd --default-character-set=utf8 $DbName > /var/$dumpFileName`;

 

反撇号其他用法

1

2

3

4

5

6

7

8

9

10

#使用反撇号,暗示作为命令来执行

$result=`date`;

echo "

the server timestamp is: $result

";

 

echo "


";

#使用shell_exec()

$result1=shell_exec("date");

echo "

the server timestamp is: $result1

";

?>

输出结果如下:
the server timestamp is: 当前日期: 2009/06/30 二输入新日期: (年月日)

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment