Esempio n. 1
0
 /**
  * 单例
  *
  * @return Lib\Instance
  */
 public static function getInstance()
 {
     if (!self::$_instance instanceof self) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Esempio n. 2
0
 public function register($username, $email, $password)
 {
     LibLoader::loadOne("string_util");
     $passwordHash = str_salted_hash($password);
     $user = array('username' => $username, 'email' => $email, 'password' => $passwordHash);
     $this->insert($this->table, $user);
 }
Esempio n. 3
0
 public static function get_instance()
 {
     if (is_null(self::$instance)) {
         $c = __CLASS__;
         self::$instance = new $c();
     }
     return self::$instance;
 }
Esempio n. 4
0
 /**
  * 数据缓存
  */
 public function cacheAction()
 {
     $mc_conf = RThink_Config::get('memcache');
     // var_dump($mc_conf);
     $mc = LibLoader::factory('cache', array('adapter' => 'memcache', 'params' => $mc_conf), true);
     $key = 'lang';
     $val = 'php';
     $mc->save($val, $key);
     //
     //        $mc->remove($key);
     //        $mc->touch($key, 10);
     //
     $res = $mc->load($key);
     //
     $metata = $mc->getMetadatas($key);
     //
     var_dump($res, $metata);
 }
Esempio n. 5
0
<?php

LibLoader::loadOne("string_util");
LibLoader::loadOne("array_util");
LayoutManager::addLayoutFolder("views");
Esempio n. 6
0
/**
 * Created by PhpStorm.
 * User: vesel
 * Date: 05.11.2015
 * Time: 18:55
 */
mb_internal_encoding("utf-8");
spl_autoload_register("autoload");
session_start();
KeyConfigLoader::selectFile("main");
require_once "dependencies.php";
if (KeyConfigLoader::getValue("auto-index-libraries") == "true") {
    LibLoader::indexLibraries();
}
if (KeyConfigLoader::getValue("auto-load-libraries") == "true") {
    LibLoader::loadAll();
}
if (KeyConfigLoader::getValue("auto-index-layouts") == "true") {
    LayoutManager::indexLayouts();
}
$router = new RouterController();
$router->process($_SERVER['REQUEST_URI']);
$router->createView();
function autoload($class)
{
    if (strpos($class, "Controller") !== false) {
        require_once "controllers/{$class}.php";
    } else {
        require_once "models/{$class}.php";
    }
}