PHP/Utility Function/passthru
Содержание
passthru() function works like exec(), except that the command output is automatically output.
<source lang="html4strict">
Its syntax is: void passthru (string command [, int return_variable]) If return_variable is provided, it will be assigned the command return status. use passthru() to view the uptime of the server <?
passthru("uptime");
?>
</source>
Using passthru() to Output Binary Data
<source lang="html4strict">
<?php if ( isset( $_REQUEST["image"] ) && file_exists( $_REQUEST["image"] ) ) {
header( "Content-type: image/gif" ); $image = $_REQUEST["image"]; passthru( "giftopnm $image | pnmscale -xscale .5 -yscale .5 | ppmquant 256 | ppmtogif" );
} else {
print "The image ".$_REQUEST["image"]." could not be found";
} ?>
</source>
Using the PHP passthru() Function
<source lang="html4strict">
<?php
passthru("ls", $return_val); echo "Exit code of $return_val\n";
?>
</source>
void passthru ( string command [, int &return_var] ) runs an external program
<source lang="html4strict">
<?
passthru("who");
?>
</source>