php shell

<?php
#!/usr/local/bin/php -q
function read(){
	$fp = fopen('/dev/stdin','r');
	while(!feof($fp)) {
		$tmp = fgets($fp, 255);
		$input = $input. $tmp;
	}
		
	fclose($fp);
	return $input;
}

echo "\n\r ********input start**********\n\r";
$input = read();
echo $input;
echo "\n\r ********input end**********\n\r";



[root@localhost ~]# cat a.txt |/usr/local/bin/php in.php 

你可能感兴趣的:(PHP,shell,input,FP)