blog-app/public/index.php
2021-11-13 14:19:55 +08:00

24 lines
499 B
PHP

<?php
if (preg_match(
'/\.css|\.js|\.jpg|\.png$/',
$_SERVER['REQUEST_URI'],
$match
)) {
$mimeTypes = [
'.css' => 'text/css',
'.js' => 'application/javascript',
'.jpg' => 'image/jpg',
'.png' => 'image/png'
];
$path = __DIR__ . $_SERVER['REQUEST_URI'];
if (is_file($path)) {
header("Content-Type: {$mimeTypes[$match[0]]}");
require $path;
exit;
}
}
require 'vendor/autoload.php';
require 'core/Bootstrap.php';