PHP/Utility Function/passthru
Версия от 10:37, 26 мая 2010; (обсуждение)
Содержание
passthru() function works like exec(), except that the command output is automatically output.
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");
?>
Using passthru() to Output Binary Data
<?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";
}
?>
Using the PHP passthru() Function
<?php
passthru("ls", $return_val);
echo "Exit code of $return_val\n";
?>
void passthru ( string command [, int &return_var] ) runs an external program
<?
passthru("who");
?>