Created
December 25, 2018 02:15
-
-
Save shellus/f2f4a773b15490f32b433799df73e14e to your computer and use it in GitHub Desktop.
进程管道调用php函数
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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