PHP uses backticks to execute external commands
For example:
echo `whoami`;
// Export the database, the folder to be imported must have writable permissions, and the content after -u -p must be written immediately
The code is as follows:
echo `mysqldump -h localhost -u$DbUser -p$DbPwd --default-character-set=utf8 $DbName > /var/$dumpFileName`;
Other uses of backticks
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 ";
?>
|
1
2
3
4
5
6
7
8
9
10
|
#Use a backtick to imply execution as a command
$result=`date`;echo " the server timestamp is: $result ";
echo " ";
#Use shell_exec()
$result1=shell_exec("date");
echo "the server timestamp is: $result1 ";
?>
|
The output results are as follows:
the server timestamp is: Current date: 2009/06/30 Enter the new date: (year, month, day)
http://www.bkjia.com/PHPjc/983322.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/983322.htmlTechArticlePHP uses backticks to execute external commands. For example: echo `whoami`; // Export database, file to be imported The folder must have writable permissions, and the content after -u -p must be written next to the code as follows...