philippurbschat.de/home/app/init.php

32 lines
No EOL
818 B
PHP

<?php
// Session
if (session_status() === PHP_SESSION_NONE) {
session_set_cookie_params([
'path' => '/',
'httponly' => true,
'samesite' => 'Lax'
]);
session_start();
}
date_default_timezone_set('Europe/Berlin');
// Autoloader
spl_autoload_register(function($className) {
$paths = [
__DIR__ . '/../core/',
__DIR__ . '/models/',
__DIR__ . '/services/'
];
foreach ($paths as $path) {
$file = $path . $className . '.php';
$fileLower = $path . strtolower($className) . '.php';
if (file_exists($file)) {
require_once $file;
return;
} elseif (file_exists($fileLower)) {
require_once $fileLower;
return;
}
}
});
// Environment
Config::load(__DIR__ . '/../.env');