call command line program with php

2019-03-07 08:43发布

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. Anyone know how to do this though?

Thanks in advance for the advice

3条回答
欢心
3楼-- · 2019-03-07 09:09

This link should help you. A quick example:

<?php
  $out = array();
  exec = ('ls /ver 2>&1', $out);
  print_r($out);
?>
查看更多
唯我独甜
4楼-- · 2019-03-07 09:15

Read the documentation for system() and exec(), it should what you need.

查看更多
登录 后发表回答