请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

正在回答 回答被采纳积分+3

3回答

提问者 慕仰7809215 2018-04-15 23:01:39


$http=new swoole_http_server('0.0.0.0',8811);
$http->on('request',function ($request,$response){
   //获取redis里面的key的内容,然后输出到浏览器
   $redis = new Swoole\Coroutine\Redis();
   $redis->connect('127.0.0.1', 6379);
   $value=$redis->get($request->get['xiaosong']);
   $response->header('Content-type','text/plain');
   $response->end($value);
});
$http->start();

0 回复 有任何疑惑可以回复我~
提问者 慕仰7809215 2018-04-15 23:00:29



PHP Fatal error:  Uncaught Error: Maximum function nesting level of '256' reached, aborting! in /home/wwwroot/default/swoole_mooc/demo/coroutine/redis.php:18

Stack trace:

#0 [internal function]: Swoole\Coroutine\Redis->close()

#1 /home/wwwroot/default/swoole_mooc/demo/coroutine/redis.php(18): Swoole\Coroutine\Redis->__destruct()

#2 {main}


Next Error: Maximum function nesting level of '256' reached, aborting! in /home/wwwroot/default/swoole_mooc/demo/coroutine/redis.php:0

Stack trace:

#0 [internal function]: Swoole\Http\Response->end()

#1 /home/wwwroot/default/swoole_mooc/demo/coroutine/redis.php(18): Swoole\Http\Response->__destruct()

#2 {main}


Next Error: Maximum function nesting level of '256' reached, aborting! in /home/wwwroot/default/swoole_mooc/demo/coroutine/redis.php:0

Stack trace:

#0 [internal function]: Swoole\Coroutine\Redis->close()

#1 /home/wwwroot/default/swoole_mooc/demo/coroutine/redis.php(18): Swoole\Coroutine\Redis->__destruct()

#2 {main}

  thrown in /home/wwwroot/default/swoole_mooc/demo/coroutine/redis.php on line 0

PHP Stack trace:

PHP   1. {main}() /home/wwwroot/default/swoole_mooc/demo/coroutine/redis.php:0

PHP   2. Swoole\Http\Server->start() /home/wwwroot/default/swoole_mooc/demo/coroutine/redis.php:24

PHP   3. {closure:/home/wwwroot/default/swoole_mooc/demo/coroutine/redis.php:16-23}() /home/wwwroot/default/swoole_mooc/demo/coroutine/redis.php:0

PHP   4. Swoole\Coroutine\Redis->connect() /home/wwwroot/default/swoole_mooc/demo/coroutine/redis.php:19

PHP   5. {closure:/home/wwwroot/default/swoole_mooc/demo/coroutine/redis.php:16-23}() /home/wwwroot/default/swoole_mooc/demo/coroutine/redis.php:0

PHP   6. Swoole\Coroutine\Redis->connect() /home/wwwroot/default/swoole_mooc/demo/coroutine/redis.php:19

PHP   7. {closure:/home/wwwroot/default/swoole_mooc/demo/coroutine/redis.php:16-23}() /home/wwwroot/default/swoole_mooc/demo/coroutine/redis.php:0


0 回复 有任何疑惑可以回复我~
  • singwa #1
    如果换成 异步redis 试试是否可以?
    回复 有任何疑惑可以回复我~ 2018-04-16 01:13:28
  • #0 [internal function]: Swoole\Coroutine\Redis->close()
    你关闭了 redis ,需要开启
    回复 有任何疑惑可以回复我~ 2019-03-17 18:10:55
singwa 2018-04-13 16:58:56

您好。代码贴下,以及你那边的错误信息帖下。

0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信