Ejemplo n.º 1
0
 public static function getInstance()
 {
     if (!self::$_instance instanceof self) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Ejemplo n.º 2
0
 public function __construct()
 {
     $this->db = Alxw::getInstance()->DB();
     if ($this->db->query("show tables like 'Settings'")->num_rows() != 1) {
         $this->db->struct(array('key' => 'text', 'val' => 'text'))->create('Settings');
     }
 }
Ejemplo n.º 3
0
 public function run()
 {
     $is_match = false;
     foreach ($this->rules as $route => $callback) {
         if ('default' === $route) {
             continue;
         }
         if ($route == $this->url) {
             $is_match = true;
             $callback();
             break;
         }
     }
     if (!$is_match) {
         $arr = explode('/', $this->url);
         if ($arr[1] === 'Activity' && isset($arr[2])) {
             Alxw::getInstance()->ClassLoader($arr[2]);
         } else {
             $this->rules['default']();
         }
     }
 }
Ejemplo n.º 4
0
<?php

/**
        Author: SpringHack - springhack@live.cn
        Last modified: 2015-12-06 03:11:43
        Filename: index.php
        Description: Created by SpringHack using vim automatically.
**/
//引入Alxw框架
require_once "Library/Alxw.php";
//默认路由规则
Alxw::getInstance()->Router()->add('default', function () {
    Alxw::getInstance()->ClassLoader('FNF');
});
//首页路由规则
Alxw::getInstance()->Router()->add('/', function () {
    Alxw::getInstance()->ClassLoader('Index');
});
//phpinfo规则
Alxw::getInstance()->Router()->add('/php', function () {
    phpinfo();
});
//启动路由
Alxw::getInstance()->Router()->run();
Ejemplo n.º 5
0
 public function __construct()
 {
     $this->dom = Alxw::getInstance()->R()->Layout()->get('404');
     $this->dom->show();
 }
Ejemplo n.º 6
0
 protected function setLayout($layout)
 {
     $this->Document = Alxw::getInstance()->R()->Layout()->get($layout);
     $this->HTML = $this->Document->HTML;
 }