Skip to content

Commit

Permalink
提示与说明优化
Browse files Browse the repository at this point in the history
  • Loading branch information
flxxyz committed Aug 15, 2018
1 parent 85c1eea commit 34fc1eb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
## 介绍
一个基于swoole的封装程序

## 配置项
## 实例

```php
return [
$config = [
'timezone' => 'Asia/Shanghai',
'tick_interval_timer' => 30, //秒
'websocket' => [
Expand Down Expand Up @@ -54,6 +54,9 @@ return [
'handler' => '',
],
];

$server = new \swoole_websocket_and_tcp_and_udp\Server($config);
$server->run();
```

## 任务
Expand Down
7 changes: 5 additions & 2 deletions src/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ public function __construct($config)

$this->otherConfig[$name] = $item;
}
// var_dump($this->otherConfig);exit(1);

$host = $this->primaryConfig['host'];
$port = $this->primaryConfig['port'];
Expand Down Expand Up @@ -237,7 +236,11 @@ public function Start(\swoole_http_server $server)
$this->setProcessName('master process');

if (version_compare(\swoole_version(), '1.10.4', '>=')) {
file_put_contents($this->config['pid_file'], $server->master_pid);
if (isset($this->config['pid_file'])) {
if (is_dir(dirname($this->config['pid_file']))) {
file_put_contents($this->config['pid_file'], $server->master_pid);
}
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/common/Swoole.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public function checkSwoole($version = '1.10.4')
}

//exec("php --ri swoole | grep Version | awk '{print $3}'");
if(!version_compare(\swoole_version(), $version, '<')) {
if(!version_compare(\swoole_version(), $version, '>=')) {
throw new \Exception("swoole扩展版本小于{$version}");
}
}
Expand Down

0 comments on commit 34fc1eb

Please sign in to comment.