<?php
#!/usr/local/bin/php -q
function read(){
$fp = fopen("php://stdin", "r");
while(!feof($fp)) {
$tmp = fgets($fp, 255);
$input = $input. $tmp;
}
fclose($fp);
return $input;
}
$input = read();
echo $input;
php处理文件流
cat a.txt |/usr/local/bin/php in.php