Skip to content

Commit

Permalink
增加3.1说明
Browse files Browse the repository at this point in the history
  • Loading branch information
hetao committed Mar 24, 2016
1 parent 42d5764 commit 11b156a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.MD
@@ -1,5 +1,9 @@
# SlightPHP 高效的PHP敏捷开发框架

### v3.1更新如下
- 更新pecl,更好支持php7,php5
- 优化SDb,SRedis,增加错误连接重置,可以更好的支持WorkerMan

### v3.0支持composer,同时需要php5.3及以上
- 安装方法一 ,执行下面的命令
```bash
Expand Down

2 comments on commit 11b156a

@jbkingsley
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

刚好在使用workerMan,不知workerMan,以什么样的建议结构方式跟slightPHP整合,能够方便是使用SDb呢?:):):)

@hetao29
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

require_once 'global.php'; //可以参考 samples/www/global.php  

SlightPHP::setAppDir(ROOT_APP);

//{{{
SDb::setConfigFile(ROOT_CONFIG. "/db.conf");
SRedis::setConfigFile(ROOT_CONFIG. "/redis.conf");
//}}}

require_once(ROOT_LIBS."/Workerman-master/Autoloader.php");

use Workerman\Worker;

// 将屏幕打印输出到Worker::$stdoutFile指定的文件中
Worker::$stdoutFile = '/tmp/stdout.log';

$http_worker = new Worker("http://0.0.0.0:2345");
$http_worker->onConnect = function($connection){
    //echo "new connection from ip " . $connection->getRemoteIp() . "\n";
};
$http_worker->onMessage = function($connection, $data){
    if(($r=SlightPHP::run())===false){
        $connection->send("404 error");
    }elseif(is_object($r) || is_array($r)){
        $connection->send(SJson::encode($r));
    }else{
        $connection->send($r);
    }
    $connection->close();
};
Worker::runAll();

Please sign in to comment.