$data = $class::$method($url_parts); $data['session'] = $_SESSION; if (isset($data['redirect'])) { header("Location: " . $data['redirect']); } else { $twig = startTwig(); if (isset($data['template'])) { $twig = startTwig(); $template = $data['template']; } echo $twig->render($template, $data); } } else { require_once "classes/User.controller.php"; $twig = startTwig(); $data = User::home(); echo $twig->render($data['template'], $data); } function getUrlParts($get) { if (isset($get) and count($get) > 0) { $get_params = array_keys($get); $url = $get_params[0]; $url_parts = explode("/", $url); foreach ($url_parts as $k => $v) { if ($v) { $array[] = $v; } } $url_parts = $array; return $url_parts;
<?php session_start(); include_once '/var/www/html/site/lib/config.php'; include_once LIB_DIR . "/helpers.php"; include_once LIB_DIR . "/router.php"; include_once LIB_DIR . "/dbconnect.php"; include_once LIB_DIR . "/convertString.ini.php"; include_once LIB_DIR . "/ini.php"; include_once BASE_DIR . "/model/user.php"; //$app = new AppIni; $c = new User(); if ($_POST['type'] == 'login') { $c->home(); } elseif ($_POST['type'] == 'forget') { $c->forget(); } elseif ($_POST['type'] == 'forgetnickname') { $c->forgetnickname(); } elseif ($_POST['type'] == 'logAff') { $c->logAffiliate(); } elseif ($_POST['type'] == 'nicknamechange') { $c->nicknamechange(); } else { if (empty($_SESSION['auth_id'])) { //'请先登入会员账号' $ret['status'] = 1; echo json_encode($ret); exit; } else { if ($_POST['type'] == 'profile') { $c->profile();