Btoc.php 836 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace app\index\controller;
  3. use think\Controller;
  4. class Btoc extends Controller
  5. {
  6. public function index()
  7. {
  8. $post['name'] = 'ayy';
  9. $data['url'] = 'http://hm.hemadj.com/dev/test';
  10. $data['method'] = 'post';
  11. $data['data'] = $post;
  12. _curl($data);
  13. $result = $this->xtox('btoc');
  14. }
  15. public function xtox($listname){
  16. $redis = new \Redis();
  17. $redis->connect('39.97.239.116', 6379);
  18. $redis->auth('huaxiashangmeng');
  19. $redis->select(1);
  20. while(true){
  21. try{
  22. $value = $redis->BRPOP($listname,0);
  23. if(!$value){
  24. break;
  25. }
  26. return $value;
  27. }catch(Exception $e){
  28. return $e->getMessage();
  29. }
  30. }
  31. }
  32. }