| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?php
- /**
- * Created by PhpStorm.
- * User: Administrator
- * Date: 2019/5/27
- * Time: 9:28
- */
- define('START_TIME', microtime(true));
- require __DIR__.'/../vendor/autoload.php';
- \datainf\lib\boot::init();
- $config = \datainf\lib\GlobConfigs::getKey('pgsqlpoole');
- $client = new swoole_client(SWOOLE_SOCK_TCP);
- $client->set(array(
- 'socket_buffer_size' => 1024*1024*8, //2M缓存区
- ));
- $rts= $client->connect('192.168.2.200', $config['poole_port'], 10) or die("连接失败");//链接mysql客户端
- $sql =("select * from account where id=83632");
- $client->send($sql);
- $resdata = $client->recv();
- print_r(json_decode($resdata,true)) ;
- /*
- $sql ="select * from \"districts\" where id>=1 and id<=300" ;
- $client->send($sql);
- $resdata = $client->recv();
- print_r(json_decode($resdata,true)) ;
- */
- $client->close();
- /*
- echo "收到: ".$resdata."\n" ;
- $resda=json_decode($resdata,true);
- $client->close();
- return json_encode($resda);
- */
|