exec 或者 system 都可以调用cmd 的命令
直接上代码:
复制代码 代码如下:
<"C:/Program Files/MySQL-Front"';
$somecontent .= '
start MySQL-Front.exe';
if (!$handle = fopen($filename, 'w')) {
echo "不能打开文件 $filename";
exit;
}
/** 首先我们要确定文件存在并且可写*/
if (is_writable($filename)) {
/** 那就是当我们使用fwrite()的时候,$somecontent将要写入的地方
将$somecontent写入到我们打开的文件中 。*/
if (fwrite($handle, $somecontent) === FALSE) {
echo "不能写入到文件 $filename";
exit;
}
echo "成功地将 $somecontent 写入到文件 $filename";
fclose($handle);
} else {
echo "文件 $filename 不可写";
}
exec($filename);
"codetitle">复制代码 代码如下:
<"dir", $out, $status);
print_r($a);
print_r($out);
print_r($status);
"codetitle">复制代码 代码如下:
<"dir", $status);
print_r($a);
print_r($status);
"codetitle">复制代码 代码如下:
<"codetitle">复制代码 代码如下:
++++++++++++++++++++++++++++++++++++++++++
2014-10-15 16:28:52
$lastLine
++++++++++++++++++++++++++++++++++++++++++
2014-10-15 16:28:52
root 5375 5373 0 16:28 pts/1 00:00:00 grep magent
++++++++++++++++++++++++++++++++++++++++++
2014-10-15 16:28:52
$retVal
++++++++++++++++++++++++++++++++++++++++++
2014-10-15 16:28:52
0
【exec】
复制代码 代码如下:
<"codetitle">复制代码 代码如下:
++++++++++++++++++++++++++++++++++++++++++
2014-10-15 16:25:00
$lastLine
++++++++++++++++++++++++++++++++++++++++++
2014-10-15 16:25:00
root 5360 5358 0 16:25 pts/1 00:00:00 grep magent
++++++++++++++++++++++++++++++++++++++++++
2014-10-15 16:25:00
$output
++++++++++++++++++++++++++++++++++++++++++
2014-10-15 16:25:00
Array
(
[0] => root 2838 1 0 15:39 "http://php.net/manual/zh/function.system.php">http://php.net/manual/zh/function.system.php
http://php.net/manual/zh/function.exec.php