代码拉取完成,页面将自动刷新
<?php
/**
* Application execution begins here.
*/
use Core\Session;
use Core\Cookie;
use Core\Router;
use App\Models\Users;
use Dotenv\Dotenv;
// Boiler plate imports.
define('DS', DIRECTORY_SEPARATOR);
define('ROOT', dirname(__FILE__));
require_once('vendor/autoload.php');
$dotenv = Dotenv::createImmutable(__DIR__);
$dotenv->load();
// Load configuration and helper functions.
require_once(ROOT . DS . 'config' . DS . 'config.php');
/**
* Auto-loading of classes using PSR-4 Support.
*
* @param string $className Path to file we will used for auto-loading
* classes that are used by this application.
* @return void
*/
function autoload($className) {
$classArray = explode('\\', $className);
$class = array_pop($classArray);
$subPath = strtolower(implode(DS, $classArray));
$path = ROOT . DS . $subPath . DS . $class . '.php';
if(file_exists($path)) {
require_once($path);
}
}
spl_autoload_register('autoload');
session_start();
// Create an array from our URL.
switch (SERVER_TYPE) {
case "nginx":
$url = isset($_SERVER['REQUEST_URI']) ? explode('/', ltrim($_SERVER['REQUEST_URI'], '/')) : [];
break;
default:
$url = isset($_SERVER['PATH_INFO']) ? explode('/', ltrim($_SERVER['PATH_INFO'], '/')) : [];
}
// Determine session and cooking status. Log in user if appropriate cookie exists.
if(!Session::exists(CURRENT_USER_SESSION_NAME && Cookie::exists(REMEMBER_ME_COOKIE_NAME))) {
Users::loginUserFromCookie();
}
// Route the request
Router::route($url);
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。