public function model() { header('Last-Modified:' . date(DATE_RFC822)); tools::markTime('test'); Loader::model('User'); // $user = new User; // $user->name = 'imp'; // $user->age = 1; // $user->save(); // $db = DB::connection()->db(); // $db->setTable('user'); // $db->beginTransaction(); // $db->insert('user', array('username' => 'air_' . mt_rand(1000000, 9999999), 'password' => 123456)); // $db->insert('user', array('username' => 'air5', 'password' => 123456)); // //$db->commit(); // $db->rollback(); // die(); // DB::begin(); // $res = DB::table('user')->insert(array('username' => 'air_' . mt_rand(1000000, 9999999), 'password' => 123456)); // $res2 = DB::table('user')->insert(array('id' => 6, 'username' => 'air5', 'password' => 123456)); // //DB::commit(); // //DB::rollback(); // die(); DB::transaction(function () { $res = DB::table('user')->insert(array('username' => 'air_' . mt_rand(1000000, 9999999), 'password' => 123456)); $res2 = DB::table('user')->insert(array('username' => 'air5', 'password' => 123456)); }); die; tools::markTime('init2'); $res = DB::table('test')->join('user')->on('user', 'test.id', '=', 'user.id')->leftJoin('test2')->on('test2', 'test2.id', '=', 'test.id')->all(); hprint($res, 1); //hprint($_SERVER, 1); $res = User::find(5); hprint($res); tools::markTime('init2.2'); $res = User::where(array('id' => 6))->get(); hprint($res); $user = new User(); tools::markTime('init4'); $res = $user->getOne(); hprint($res); //$res = user::all(); //$res = User::where(array('id' => 3))->all(); //$res = User::create(array('username' => 'imp_' . mt_rand(1000, 9999), 'password' => 123456, 'time' => time()), true); //hprint($res); $user->all1(); //$res = DB::table('test')->where(array('id' => 1))->get(); // DB::connection('imp'); // $res2 = DB::table('system_user')->where(array('id' => 1))->get(); // hprint($res2); tools::markTime('init3'); echo tools::showTime(); }
public function get($uid) { // hprint(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS)); // debug_print_backtrace(); // go(); xdebug; $a = array('a' => 'a'); debug_zval_dump($a); die; import('Mc'); $mc = Mc::getInstance(); hprint($mc); $mc->increment('aa', 1); $res = $mc->get('aa'); echo $res; echo '<br>'; //print_r($user->get()); }
public function all1() { $res = $this->fetch(); // hprint($res); $res = $this->where('id', '<', 30)->limit(2)->orderBy('id DESC')->all(); hprint($res); $res = $this->select(array('id'))->page(1, 5); hprint($res); // $this->where('id', '=', 5)->increment('level', 1); // $res = $this->insert(array( // 'username' => 'abc', // 'password' => '123456', // 'age' => 18, // 'sex' => 1, // 'time' => time(), // ), true); // hprint($res); // $res = $this->where(array('id' => 8))->update(array('password' => '234567')); // $count = $this->count(); // hprint($count); // $res = $this->where(array('id' => 8))->delete(); // hprint($res); //return $this->fetch(); }