Skip to content

Commit

Permalink
Update 03.swoole_server函数列表.md
Browse files Browse the repository at this point in the history
  • Loading branch information
LinkedDestiny committed Nov 10, 2014
1 parent 0e5f320 commit c34c4b5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion doc/03.swoole_server函数列表.md
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ public function swoole_server::task(string $data, int $dst_worker_id = -1);

**说明**:<br>
此功能用于将慢速的任务异步地去执行,调用task函数会立即返回,Worker进程可以继续处理新的请求。<br>
函数会返回一个`$task_id`数字,表示此任务的ID<br>
任务完成后,可以通过return(低于swoole-1.7.2版本使用[finish](#swoole_serverfinish)函数)将结果通过[onFinish](https://github.com/LinkedDestiny/swoole-doc/blob/master/doc/02.%E4%BA%8B%E4%BB%B6%E5%9B%9E%E8%B0%83%E5%87%BD%E6%95%B0.md#7onfinish)回调返回给Worker进程。<br>
发送的data必须为字符串,如果是数组或对象,请在业务代码中进行serialize处理,并在[onTask](https://github.com/LinkedDestiny/swoole-doc/blob/master/doc/02.%E4%BA%8B%E4%BB%B6%E5%9B%9E%E8%B0%83%E5%87%BD%E6%95%B0.md#6ontask)/[onFinish](https://github.com/LinkedDestiny/swoole-doc/blob/master/doc/02.%E4%BA%8B%E4%BB%B6%E5%9B%9E%E8%B0%83%E5%87%BD%E6%95%B0.md#7onfinish)中进行unserialize。<br>
data可以为二进制数据,最大长度为**8K**(超过8K可以使用临时文件共享)。字符串可以使用gzip进行压缩。<br>
Expand Down Expand Up @@ -751,4 +752,4 @@ array swoole_get_local_ip();
**样例**:
```php
var_dump(swoole_get_local_ip());
```
```

0 comments on commit c34c4b5

Please sign in to comment.