Skip to content

Commit cc7d450

Browse files
committed
Add console output
1 parent 270db98 commit cc7d450

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

route.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,20 @@
3333
// Only when using PHP built-in web server
3434
chdir(__DIR__);
3535

36+
// Console Output
37+
$green = "\033[32m";
38+
$yellow = "\033[33m";
39+
$cyan = "\033[36m";
40+
$red = "\033[31m";
41+
$blue = "\033[34m";
42+
$reset = "\033[0m";
43+
44+
$uri = $_SERVER['REQUEST_URI'];
45+
$method = $_SERVER['REQUEST_METHOD'];
46+
$time = date('Y-m-d H:i:s');
47+
48+
file_put_contents('php://stdout', "\033[33m $time \033[36m $method \033[32m $uri \033[0m \n");
49+
3650
// Parse the request
3751
$url_path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
3852
$filePath = ltrim($url_path, '/');

0 commit comments

Comments
 (0)