监理公司管理系统 | 工程企业管理系统 | OA系统 | ERP系统 | 造价咨询管理系统 | 工程设计管理系统 | 签约案例 | 购买价格 | 在线试用 | 手机APP | 产品资料
X 关闭
新余网站建设公司

当前位置:工程项目OA系统 > 泛普各地 > 江西OA系统 > 新余OA > 新余网站建设公司

PHP调用Linux系统的常用函数

申请免费试用、咨询电话:400-8352-114

PHP调用Linux系统的常用函数

  1、exec函数

  <?php

  $test = "ls /tmp/test"; //ls是linux下的查目录,文件的命令

  exec($test,$array); //执行命令

  print_r($array);

  ?>

  2、system函数

  <?php

  $test = "ls /tmp/test";

  $last = system($test);

  print "last: $lastn";

  ?>

  3、passthru函数

  <?php

  $test = "ls /tmp/test";

  passthru($test);

  ?>

  4、popen函数

  <?php

  $test = "ls /tmp/test";

  $fp = popen($test,"r"); //popen打一个进程通道

  while (!feof($fp)) { //从通道里面取得东西

  $out = fgets($fp, 4096);

  echo $out; //打印出来

  }

  pclose($fp);

  ?>

  5、proc_open函数

  <?php

  $test = "ls /tmp/test";

 

  $arrayarray = array(

  array("pipe","r"), //标准输入

  array("pipe","w"), //标准输出内容

  array("pipe","w") //标准输出错误

  );

  $fp = proc_open($test,$array,$pipes); //打开一个进程通道

  echo stream_get_contents($pipes[1]); //为什么是$pipes[1],因为1是输出内容

  proc_close($fp);

  ?>

  6、proc_open函数

  <?php

  $test = "ls /tmp/test";

  $arrayarray = array(

  array("pipe","r"), //标准输入

  array("pipe","w"), //标准输出内容

  array("pipe","w") //标准输出错误

  );

  $fp = proc_open($test,$array,$pipes); //打开一个进程通道

  echo stream_get_contents($pipes[1]); //为什么是$pipes[1],因为1是输出内容

  proc_close($fp);

  ?>

  7、shell_exec函数

  <?php

  $test = "ls /tmp/test";

  $out = shell_exec($test);

  echo $out;

  ?>

发布:2007-03-31 15:14    编辑:泛普软件 · xiaona    [打印此页]    [关闭]
新余OA
联系方式

成都公司:成都市成华区建设南路160号1层9号

重庆公司:重庆市江北区红旗河沟华创商务大厦18楼

咨询:400-8352-114

加微信,免费获取试用系统

QQ在线咨询

泛普新余网站建设公司其他应用

新余软件开发公司 新余门禁系统 新余物业管理软件 新余仓库管理软件 新余餐饮管理软件 新余网站建设公司