12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- namespace app\index\controller;
- use think\Controller;
- use Redis;
- use \GatewayWorker\Lib\Gateway;
- class Test extends Controller
- {
- public function test(){
- $Gateway = new Gateway();
- $Gateway::$registerAddress = '127.0.0.1:2345';
- $Gateway::sendToAll('来自服务端的主动推送'.date('Y-m-d H:i:s'));
- }
- public function ip(){
- $ipaddress = ip_to_address();
- echo $ipaddress;
- }
- public function newip(){
- $ipaddress = newip_to_address();
- echo $ipaddress;
- }
- public function test_redis(){
- $redis = new Redis();
- $redisconfig = config("redis");
- $redis->connect($redisconfig["host"], $redisconfig["port"]);
- if ($redisconfig['redis_pwd']) {
- $redis->auth($redisconfig['redis_pwd']);
- }
- if($redisconfig['redis_selectdb'] > 0){
- $redis->select($redisconfig['redis_selectdb']);
- }
- $key = 'party_giveGiftToYou_180';
- $redis->incr($key);
- $redis->pExpire($key, 100000);
- }
- }
|