insert($data); echo $id ."\r\n"; $data = $cat->getList(); //echo Dever::sql(); print_r($data); $data['name'] = '潮流' . time(); $data['id'] = 1; $id = $cat->insert($data); echo $id ."\r\n"; $data = $cat->getList(); //echo Dever::sql(); print_r($data); return; } # 测试事务方式2 public function test_shiwu_api() { $cat = Dever::db('demo/cat'); try { $cat->begin(); $data['name'] = '服饰' . time(); $id = $cat->insert($data); echo $id ."\r\n"; $data['name'] = '潮流' . time(); $data['id'] = 1; $id = $cat->insert($data); echo $id ."\r\n"; $cat->commit(); } catch (\Exception $e) { $cat->rollBack(); } $data = $cat->getList(); echo Dever::sql(); print_r($data);die; } public function curl_api() { //$data = Dever::load('http://www.vogue.com.cn/'); //print_r($data);die; $data = Dever::load('cms/service/news.test_display_data'); print_r($data);die; } public function data() { return array ( 0 => array ( 'id' => 1, 'name' => 't1', ), 1 => array ( 'id' => 2, 'name' => 't2', ) ); } public function proxy_api() { $method = Dever::input('method'); return Dever::load($method); } public function info() { return array ( 'name' => 'bill', ); } public function getData() { $config = array ( 'id' => 1, 'type' => 3, 'data1' => array ( 0 => array ( 'id' => 1, 'name' => 't1', ), 1 => array ( 'id' => 2, 'name' => 't2', ) ), 'data2' => array ( 0 => array ( 'id' => 3, 'name' => 't3', ), 1 => array ( 'id' => 4, 'name' => 't4', ) ), ); return $config; } public function index($name, $id) { //Dever::cache('test', array('1111')); //return 222; return Dever::load('demo/vogue/cat.test'); return Dever::db('demo/cat')->all(); Dever::$global['test'] = 1; return Dever::load('demo/vogue/cat.data', 1, '23232'); //$cat = Dever::load('demo/vogue/cat'); $cat = new Cat(); if ($id == 1) { Dever::alert('错误'); } //Dever::out($cat->data());die; return $cat->data(); return $name; } public function test_display_api() { $data['test'] = 1111111111111; $data['data'] = $this->test_foreach(); //return $data; return Dever::render('index', $data); } public function test_display_data() { return 12323234; } public function test_foreach() { $config = array ( array ( 'id' => 1, 'name' => '1111', 'child' => array ( array ( 'id' => 3, 'name' => '3333', 'child' => array ( array ( 'id' => 9, 'name' => '9999', ), array ( 'id' => 10, 'name' => '10101010', ) ), ), array ( 'id' => 4, 'name' => '4444', ) ), ), array ( 'id' => 2, 'name' => '2222', 'child' => array ( array ( 'id' => 5, 'name' => '5555', ), array ( 'id' => 6, 'name' => '6666', ) ), ) ); return $config; } }