1,exec函数
<?php
$test = "ls /tmp/test";
//ls是linux下的查目录,文件的命令
exec($test,$array);
//执行命令
print_r($array);
?>
返回结果如下:
[root@krlcgcms01 shell]# php ./exec.php
Array
(
[0] => 1001.log
[1] => 10.log
[2] => 10.tar.gz
[3] => aaa.tar.gz
[4] => mytest
[5] => test1101
[6] => test1102
[7] => weblog_2010_09
)