where('id',766)->first()); ModelBase::init()->getConnection()->disconnect(); echo "---------------------\n\n\n"; //$obj->getConnection()->disconnect(); //var_dump(DB::table('datainf_log')->where('id',766)->first()); $sql = "select * from datainf_log where id in (766,767) "; $pdo = ModelBase::init()->getConnection()->getPdo(); foreach ($pdo->query($sql ) as $row) { print_r($row); //你可以用 echo($GLOBAL); 来看到这些值 } /* try{ ModelBase::beginTransaction(); $model = new \App\Http\Model\StZqResult(); $ret = $model->where(['id'=>4314])->first(); print_r($ret); ModelBase::commit(); }catch (\Exception $e){ echo $e->getMessage(); ModelBase::rollBack(); } $model = new App\Lib\TestModel(); $model->name = 'name_'.mt_rand(1000,99999) ; $model->sex = '男'; $model->age = mt_rand(10,50); $ret = $model->save(); print_r([$ret,$model->toArray()]); */ /* function request_post($url = '', $param = '') { if (empty($url) || empty($param)) { return false; } $postUrl = $url; $curlPost = $param; $ch = curl_init();//初始化curl curl_setopt($ch, CURLOPT_URL,$postUrl);//抓取指定网页 curl_setopt($ch, CURLOPT_HEADER, 0);//设置header curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//要求结果为字符串且输出到屏幕上 curl_setopt($ch, CURLOPT_POST, 1);//post提交方式 curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost); $data = curl_exec($ch);//运行curl curl_close($ch); return $data; } $data=[ 'token'=>'xxxx', 'ccav'=>'ccav', ]; $ret = request_post('http://192.168.2.200:9093/abcd',$data); print_r($ret); */ /* $str = ''; $arr = json_decode($str,true); $arr2 = json_decode( $arr['0']['data'] ,true); foreach ($arr2 as $val){ print_r($val); echo "\n\n"; } */