<>PHP call shell command 
 <> preface 
 Because I want to use it php call python script , So I thought we could use it php call shell Method implementation of command .
 php edition :php7.0
 <> Three methods 
 <>1.system
system —  Executing external procedures , And display the output 
 How to use functions 
system ( string $command [, int &$return_var ] ) : string 
example:
<?php $last_line = system('ls',$return_val); echo(“last line:”.$last_line); 
echo(“return:”.$return_val); 
 explain : Yes shell command , And output its return result directly ;
  The return result of the function is shell The last line of the command output ;
 $return_val by shell The return result of the command .
 <>2.exec
exec —  Execute an external program 
exec ( string $command [, array &$output [, int &$return_var ]] ) : string 
example:
<?php exec('ls',$out); var_dump($out); 
 explain :exec The return result of the function is shell The last line of the command output ;
 $output by shell Command output content ;
 $return_val by shell The command returns the result ;
 <>3.passthru
passthru —  Execute the external program and display the original output 
passthru ( string $command [, int &$return_var ] ) : void 
example:
<?php passthru('ls',$res); echo($res); 
 explain : When executed  Unix  The command outputs binary data ,  And it needs to be sent directly to the browser ,  You need to use this function instead  exec()  or  system()  function . By setting  
Content-type  by  image/gif,  Then call  pbmplus  Program output  gif  file ,  You can start from  PHP  Script output image to browser directly 
Technology