简体   繁体   English

用php调用命令行程序

[英]call command line program with php

I have a program running on my command line. 我的命令行上运行了一个程序。 The program allows one to type in a username and returns a bunch of information pertaining to that user. 该程序允许输入用户名,并返回一堆与该用户有关的信息。 I assume it is possible to access this program from php, and even store the information in a variable. 我认为可以从php访问该程序,甚至可以将信息存储在变量中。 Anyone know how to do this though? 有人知道该怎么做吗?

Thanks in advance for the advice 预先感谢您的建议

阅读system()exec()的文档,它应该是您所需要的。

This link should help you. 链接应为您提供帮助。 A quick example: 一个简单的例子:

<?php
  $out = array();
  exec = ('ls /ver 2>&1', $out);
  print_r($out);
?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM