Skip to content

Instantly share code, notes, and snippets.

@shellus
Created December 25, 2018 02:15
Show Gist options
  • Save shellus/f2f4a773b15490f32b433799df73e14e to your computer and use it in GitHub Desktop.
Save shellus/f2f4a773b15490f32b433799df73e14e to your computer and use it in GitHub Desktop.
进程管道调用php函数
$handle = fopen("php://stdin", 'r');
while (!feof($handle)) {
$line = stream_get_line($handle, 1024*1024*10, "\r\n");
$requestObj = json_decode($line, true);
$response = (new $requestObj['calss'])->$requestObj['method'](...$requestObj['args']);
echo json_encode($response) . "\r\n";
}
fclose($handle);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment