PHP用反撇号执行外部命令
例如:
echo`whoami`;
//导出数据库,要导入的文件夹必须要有可写权限,-u-p之后的内容必须要紧挨着写
echo`mysqldump-hlocalhost-u$DbUser-p$DbPwd--default-character-set=utf8$DbName>/var/$dumpFileName`;
反撇号其他用法
<?php
#使用反撇号,暗示作为命令来执行
$result=`date`;
echo"<p>theservertimestampis:$result</p>";
echo"<hrcolor=red>";
#使用shell_exec()
$result1=shell_exec("date");
echo"<p>theservertimestampis:$result1</p>";
?>
输出结果如下:
theservertimestampis:当前日期:2009/06/30二输入新日期:(年月日)
以上所述就是本文的全部内容了,希望大家能够喜欢。