Last active
August 29, 2015 14:08
-
-
Save up1/6b92ecec460ab424631a to your computer and use it in GitHub Desktop.
Demo :: php router
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
function logAccess($status = 200) { | |
file_put_contents("php://stdout", sprintf("custom =>[%s] %s:%s [%s]: %sn", | |
date("D M j H:i:s Y"), $_SERVER["REMOTE_ADDR"], | |
$_SERVER["REMOTE_PORT"], $status, $_SERVER["REQUEST_URI"])); | |
} | |
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
//Run server | |
$php -S localhost:8888 -t . router.php | |
# Output # | |
[Tue Nov 4 19:49:36 2014] ::1:49619 [200]: / | |
custom =>[Tue Nov 4 12:49:45 2014] ::1:49620 [404]: /fffn[Tue Nov 4 19:49:56 2014] ::1:49621 Invalid request (Unexpected EOF) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment