Home >Backend Development >PHP Tutorial >How to execute system commands in php, php executes system commands_PHP tutorial

How to execute system commands in php, php executes system commands_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:02:04705browse

How to execute system commands in php, php executes system commands

The example in this article describes the method of executing system commands in php. Share it with everyone for your reference. The specific analysis is as follows:

Execute system commands in php, such as LS

<&#63;php // exec.php
$cmd = "dir"; // Windows
// $cmd = "ls"; // Linux, Unix & Mac
exec(escapeshellcmd($cmd), $output, $status);
if ($status) echo "Exec command failed";
else
{
echo "<b>";
foreach($output as $line) echo "$linen";
}
&#63;>

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/970975.htmlTechArticleHow to execute system commands in php, php executes system commands. This article describes the method of executing system commands in php. Share it with everyone for your reference. The specific analysis is as follows: Executing in php...
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