多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
[TOC] ## demo index.php ``` function isWindow(){ return substr(php_uname(), 0, 7) == "Windows"; } function execInBackground($cmd) { if (isWindow()){ pclose(popen("start /B ". $cmd, "r")); } else { exec($cmd . " > /dev/null &"); } } $cmd = "/usr/bin/php client.php"; // or php client.php execInBackground($cmd); ?> <p>success </p> ``` client.php ``` $redis = new Redis(); if ( ! $redis->connect('127.0.0.1', 6379)) { print_r($redis->getLastError()); } $i=0; while (true){ if ($i==10){ return true; } $i++; //code //$redis->publish("chat", $i); //redis 发布 ,用 SUBSCRIBE chat 接受 sleep(1); } ``` 执行 ``` curl http://127.0.0.1:8080/index.php ```