Home > php教程 > php手册 > PHP用反撇号执行外部命令,php执行外部命令

PHP用反撇号执行外部命令,php执行外部命令

WBOY
Release: 2016-06-13 09:07:05
Original
1177 people have browsed it

PHP用反撇号执行外部命令,php执行外部命令

例如:

echo `whoami`;

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

复制代码 代码如下:echo `mysqldump -h localhost -u$DbUser -p$DbPwd --default-character-set=utf8 $DbName > /var/$dumpFileName`;

反撇号其他用法

<&#63;php  
  #使用反撇号,暗示作为命令来执行
  $result=`date`;
  echo "<p>the server timestamp is: $result</p>";

  echo "<hr color=red>";
  #使用shell_exec()
  $result1=shell_exec("date");
  echo "<p>the server timestamp is: $result1</p>";
&#63;>

Copy after login

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

以上所述就是本文的全部内容了,希望大家能够喜欢。

Related labels:
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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template