Processor



( ZN >= 4.0.0 )

Used to execute commands over the terminal. This libraryssh2_exec , exec , system, and sshmethods. The selected drive works according to the type of drive.

 

# Configuration


File: Config / Services.php
Processor
String $ driver = 'exec' Driver type. Which method is used in shell command operations.
Options ssh2_exec , exec , system , ssh
String $ path = '/ usr / bin / php' Expresses the current PHP path. This setting is also important for the Crontab library. ZN Terminal PHP 7 and later versions this setting because he wanted to release seven current and over PHP should be written way. By default, / usr / bin / php is set.

 

# Methods


scaler exec ( String $ command )
this driver ( String $ driver )
Array output ( Void )

 

# Exec ( ZN> = 4.0.0 )


The command to run is written. The command executed as output returns the result.

Parameters

String $ commander The command to run.
return String exec
return String sHELL
return String system
return Resource ssh

uses

echo Processor::exec('php -v');
with Zend OPcache v7.0.9, Copyright (c) 1999-2016, by Zend Technologies 

 

# Driver ( ZN> = 4.0.0 )


Used to select a different driver.

Parameters

String $ Driver Current driver name.
Options ssh2_exec , exec , system , ssh
return this

uses

echo Processor::driver('shell')->exec('php -v');
PHP 7.0.9 (cli) (built: Jul 20 2016 11:08:23) (ZTS) Copyright (c) 1997-2016 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies with Zend OPcache v7.0.9, Copyright (c) 1999-2016, by Zend Technologies 

 

# Output ( ZN> = 4.0.0 )

The command then returns the resulting output array type.

Parameters

void
return Array

uses

Processor::driver('system')->exec('php -v');

output( Processor::output() );
0 => string 'PHP 7.0.9 (cli) (built: Jul 20, 2016 11:08:23) (ZTS) (length = 55 )
1 => string "Copyright (c) 1997-2016 The PHP Group' ( length = 39 )
2 => string 'Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies' (length = 63 )
3 => string ' with Zend OPcache v7.0.9, Copyright (c) by Zend Technologies' (length = 77 )