| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- <?php
- /**
- * Created by PhpStorm.
- * User: Administrator
- * Date: 2019/5/23
- * Time: 17:42
- */
- define('START_TIME', microtime(true));
- require __DIR__ . '/../vendor/autoload.php';
- \datainf\lib\boot::init();
- use App\Lib\ModelBase;
- //use Illuminate\Database\Capsule\Manager as DB;
- ModelBase::init();
- //var_dump($obj);
- //var_dump(DB::table('datainf_log')->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";
- }
- */
|