Exemple #1
0
 /**
  * @param mixed $page_num
  */
 public static function setPageNum($page_num)
 {
     self::$page_num = $page_num;
 }
try {
    $db = new PDO('mysql:host=' . $host . ';dbname=' . $dbname, $username, $password);
} catch (PDOException $e) {
    echo "Error!: " . $e->getMessage();
}
spl_autoload_register('loadClass');
function loadClass($className)
{
    $path = explode('_', $className);
    $file = '';
    foreach ($path as $item) {
        $file .= $item . DS;
    }
    $file = substr($file, 0, -1) . '.php';
    if (!file_exists($file)) {
        return false;
    }
    include $file;
}
try {
    System_Registry::set('db', $db);
} catch (Exception $e) {
    echo $e->getMessage();
}
$router = new System_Router();
try {
    $router->setPath(SITE_PATH . 'Controller');
    $router->start();
} catch (Exception $e) {
    echo $e->getMessage();
}