| 12345678910111213141516171819202122232425262728293031323334353637 | 
							- <?php
 
- namespace app\index\controller;
 
- use app\common\controller\Frontend;
 
- class Index extends Frontend
 
- {
 
-     protected $noNeedLogin = '*';
 
-     protected $noNeedRight = '*';
 
-     protected $layout = '';
 
-     public function test1(){
 
-         // 文本加一个回车
 
-         $buffer1 = 'abcdefghijklmn';
 
- // 在php中双引号中的\n代表一个换行符,例如"\n"
 
-         $buffer2 = '{"type":"say", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello"}'."";
 
-         $buffer2 = 'abcdefghijklmn'."\n";
 
- // 与服务端建立socket连接
 
-         $client = stream_socket_client('tcp://1.14.197.70:2349');
 
- // 以text协议发送buffer1数据
 
-         //fwrite($client, $buffer1);
 
- // 以text协议发送buffer2数据
 
-         fwrite($client, $buffer2);
 
-     }
 
-     public function index()
 
-     {
 
-         return $this->view->fetch();
 
-     }
 
- }
 
 
  |