-
Notifications
You must be signed in to change notification settings - Fork 0
/
console.php
29 lines (28 loc) · 948 Bytes
/
console.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
$stream = fopen(__DIR__.'/debug.stream', 'w+');
$run = true;
while ($run) {
while (($content = fread($stream, 1024))) {
echo $content;
ftruncate($stream, filesize(__DIR__.'/debug.stream') - ftell($stream));
}
/*$stdin = array(STDIN);
$null = null;
if (stream_select($stdin, $null, $null, 0) === 1) {
echo "Input available on STDIN
";
$command = fread(STDIN, 1024*1024);
echo strstr($command, 'exit');
echo bin2hex(strstr($command, 'exit'));
if ($command === "exit\r\n") {
$run = false;
echo "Exiting\r\n";
} else if ($command == "\r\n") {
//Do nothing
} else {
echo "Unknown command : \r\n".$command."\r\n".bin2hex($command)."\r\n";
}
}*/
usleep(1);
}
fclose($stream);