全量MarkDown版本
PHP的异步、并行、高性能网络通信引擎,使用纯C语言编写,提供了PHP语言的异步多线程服务器,异步TCP/UDP网络客户端,异步MySQL,异步Redis,数据库连接池,AsyncTask,消息队列,毫秒定时器,异步文件读写,异步DNS查询。 Swoole内置了Http/WebSocket服务器端/客户端、Http2.0服务器端/客户端。
Swoole底层内置了异步非阻塞、多线程的网络IO服务器。PHP程序员仅需处理事件回调即可,无需关心底层。与Nginx
/Tornado
/Node.js
等全异步的框架不同,Swoole既支持全异步,也支持同步。
除了异步IO的支持之外,Swoole为PHP多进程的模式设计了多个并发数据结构和IPC通信机制,可以大大简化多进程并发编程的工作。其中包括了并发原子计数器,并发HashTable,Channel,Lock,进程间通信IPC等丰富的功能特性。
Swoole从2.0版本开始支持了内置协程,可以使用完全同步的代码实现异步程序。PHP代码无需额外增加任何关键词,底层自动进行协程调度,实现异步。
Swoole可以广泛应用于互联网、移动通信、企业软件、网络游戏、物联网、车联网、智能家庭等领域。 使用PHP+Swoole
作为网络通信框架,可以使企业IT研发团队的效率大大提升,更加专注于开发创新产品。
Swoole是开源免费的自由软件,授权协议是Apache2.0
。企业和个人开发者均可免费使用Swoole的代码,并且在Swoole之上所作的修改可用于商业产品,无需开源(注:必须保留原作者的版权声明)。
1.8.7
或更高版本已完全兼容PHP7
2.0.12
版本开始不再支持PHP5
1.3.1
创建TCP服务器
1.3.2
创建UDP服务器
1.3.3
创建Web服务器
1.3.4
创建WebSocket服务器
1.3.5
设置定时器
1.3.6
执行异步任务
1.3.7
创建同步TCP客户端
1.3.8
创建异步TCP客户端
1.3.9
网络通信协议设计
1.3.10
使用异步客户端
1.3.11
多进程共享数据
1.4.1
sleep/usleep的影响
1.4.2
exit/die函数的影响
1.4.3
while循环的影响
1.4.4
stat缓存清理
1.4.5
mt_rand随机数
1.7.1
2.1.2 进程池模块的使用
1.7.2
1.9.24 调度支持 Stream 模式
1.7.3
1.9.24 异步客户端自动解析域名
1.7.4
1.9.17 支持异步安全重启特性
1.7.5
1.9.14 使用异步客户端超时机制
1.7.6
1.8.0 使用内置Http异步客户端
1.7.7
1.7.16 使用迭代器遍历Server所有连接
1.7.8
1.7.5 在Server中使用swoole_table
1.7.9
1.7.5 swoole_client支持sendfile接口
1.7.10
1.7.4 SSL隧道加密TCP-Server
1.7.11
1.7.4 task进程中使用毫秒定时器
1.7.12
1.7.3 固定包头+包体协议自动分包
1.7.13
1.7.3 onTask直接return取代finish函数
1.7.14
1.7.2 swoole_process多进程模块的使用
1.7.15
1.7.2 task进程使用消息队列
1.13.1
物联网项目
1.13.2
网络游戏
1.13.3
腾讯(Tencent)
1.13.4
百度(Baidu.com)
1.13.5
阅文集团
1.13.6
BiliBili(哔哩哔哩)
1.13.7
车轮互联(chelun.com)
1.13.8
(捞月狗) 游戏社区
1.15.1
升级swoole版本的常见问题
1.15.2
生成可分发的二进制swoole版本
1.15.3
在phpinfo中有在php -m中没有
1.15.4
Connection refused是怎么回事
1.15.5
Resource temporarily unavailable [11]
1.15.6
Cannot assign requested address [99]
1.15.7
swoole与node.js相比有哪些优势
1.15.8
swoole与golang相比有哪些优势
1.15.9
pcre.h: No such file or directory
1.15.10
my_global.h: No such file or directory
1.15.11
undefined symbol: __sync_bool_compare_and_swap_4
1.15.12
学习Swoole需要掌握哪些基础知识
1.15.13
同步阻塞与异步非阻塞适用场景
1.15.14
PHP7环境下出现zend_mm_heap corrupted
1.15.15
swoole项目起源和名字由来
1.15.16
swFactoryProcess_finish (ERROR 1004): send %d byte failed, because session#%d is closed / swFactoryProcess_finish (ERROR 1005): connection[fd=%d] does not exists
2.1.1
swoole_server::__construct
2.1.2
swoole_server->set
2.1.3
swoole_server->on
2.1.4
swoole_server->addListener
2.1.5
swoole_server->addProcess
2.1.6
swoole_server->listen
2.1.7
swoole_server->start
2.1.8
swoole_server->reload
2.1.9
swoole_server->stop
2.1.10
swoole_server->shutdown
2.1.11
swoole_server->tick
2.1.12
swoole_server->after
2.1.13
swoole_server->defer
2.1.14
swoole_server->clearTimer
2.1.15
swoole_server->close
2.1.16
swoole_server->send
2.1.17
swoole_server->sendfile
2.1.18
swoole_server->sendto
2.1.19
swoole_server->sendwait
2.1.20
swoole_server->sendMessage
2.1.21
swoole_server->exist
2.1.22
swoole_server->pause
2.1.23
swoole_server->resume
2.1.24
swoole_server->getClientInfo
2.1.25
swoole_server->getClientList
2.1.26
swoole_server->bind
2.1.27
swoole_server->stats
2.1.28
swoole_server->task
2.1.29
swoole_server->taskwait
2.1.30
swoole_server->taskWaitMulti
2.1.31
swoole_server->taskCo
2.1.32
swoole_server->finish
2.1.33
swoole_server->heartbeat
2.1.34
swoole_server->getLastError
2.1.35
swoole_server->getSocket
2.1.36
swoole_server->protect
2.1.37
swoole_server->confirm
2.2.1
swoole_server::$setting
2.2.2
swoole_server::$master_pid
2.2.3
swoole_server::$manager_pid
2.2.4
swoole_server::$worker_id
2.2.5
swoole_server::$worker_pid
2.2.6
swoole_server::$taskworker
2.2.7
swoole_server::$connections
2.2.8
swoole_server::$ports
2.3.1
reactor_num
2.3.2
worker_num
2.3.3
max_request
2.3.4
max_conn (max_connection)
2.3.5
task_worker_num
2.3.6
task_ipc_mode
2.3.7
task_max_request
2.3.8
task_tmpdir
2.3.9
dispatch_mode
2.3.10
dispatch_func
2.3.11
message_queue_key
2.3.12
daemonize
2.3.13
backlog
2.3.14
log_file
2.3.15
log_level
2.3.16
heartbeat_check_interval
2.3.17
heartbeat_idle_time
2.3.18
open_eof_check
2.3.19
open_eof_split
2.3.20
package_eof
2.3.21
open_length_check
2.3.22
package_length_type
2.3.23
package_length_func
2.3.24
package_max_length
2.3.25
open_cpu_affinity
2.3.26
cpu_affinity_ignore
2.3.27
open_tcp_nodelay
2.3.28
tcp_defer_accept
2.3.29
ssl_cert_file
2.3.30
ssl_method
2.3.31
ssl_ciphers
2.3.32
user
2.3.33
group
2.3.34
chroot
2.3.35
pid_file
2.3.36
pipe_buffer_size
2.3.37
buffer_output_size
2.3.38
socket_buffer_size
2.3.39
enable_unsafe_event
2.3.40
discard_timeout_request
2.3.41
enable_reuse_port
2.3.42
enable_delay_receive
2.3.43
open_http_protocol
2.3.44
open_http2_protocol
2.3.45
open_websocket_protocol
2.3.46
open_mqtt_protocol
2.3.47
open_websocket_close_frame
2.3.48
reload_async
2.3.49
tcp_fastopen
2.3.50
request_slowlog_file
2.3.51
enable_coroutine
2.3.52
max_coroutine
2.6.1
onStart
2.6.2
onShutdown
2.6.3
onWorkerStart
2.6.4
onWorkerStop
2.6.5
onWorkerExit
2.6.6
onConnect
2.6.7
onReceive
2.6.8
onPacket
2.6.9
onClose
2.6.10
onBufferFull
2.6.11
onBufferEmpty
2.6.12
onTask
2.6.13
onFinish
2.6.14
onPipeMessage
2.6.15
onWorkerError
2.6.16
onManagerStart
2.6.17
onManagerStop
2.7.1
改变Worker进程的用户/组
2.7.2
回调函数中的 reactor_id 和 fd
2.7.3
Length_Check 和 EOF_Check 的使用
2.7.4
Worker与Reactor通信模式
2.7.5
TCP-Keepalive死连接检测
2.7.6
TCP服务器心跳维持方案
2.7.7
多端口监听的使用
2.7.8
捕获Server运行期致命错误
2.7.9
swoole_server的两种运行模式介绍
2.7.10
swoole_server中对象的4层生命周期
2.7.11
在worker进程内监听一个Server端口
2.7.12
在php-fpm/apache中使用task功能
2.8.1
为什么不要send完后立即close
2.8.2
如何在回调函数中访问外部的变量
2.8.3
swoole_server中内存管理机制
2.8.4
是否可以共用1个redis或mysql连接
2.8.5
关于onConnect/onReceive/onClose顺序
2.8.6
4种PHP回调函数风格
2.8.7
不同的Server程序实例间如何通信
2.8.8
错误信息:ERROR (9006)
2.8.9
eventLoop has already been created. unable to create swoole_server
3.1.1
swoole_client::__construct
3.1.2
swoole_client->set
3.1.3
swoole_client->on
3.1.4
swoole_client->connect
3.1.5
swoole_client->isConnected
3.1.6
swoole_client->getSocket
3.1.7
swoole_client->getSockName
3.1.8
swoole_client->getPeerName
3.1.9
swoole_client->getPeerCert
3.1.10
swoole_client->send
3.1.11
swoole_client->sendto
3.1.12
swoole_client->sendfile
3.1.13
swoole_client->recv
3.1.14
swoole_client->close
3.1.15
swoole_client->sleep
3.1.16
swoole_client->wakeup
3.1.17
swoole_client->enableSSL
3.2.1
onConnect
3.2.2
onError
3.2.3
onReceive
3.2.4
onClose
3.2.5
onBufferFull
3.2.6
onBufferEmpty
3.3.1
swoole_client->errCode
3.3.2
swoole_client->sock
3.3.3
swoole_client->reuse
3.4.1
swoole_client_select
3.4.2
TCP客户端异步连接
3.4.3
SWOOLE_KEEP建立TCP长连接
3.6.1
ssl_verify_peer
3.6.2
ssl_host_name
3.6.3
ssl_cafile
3.6.4
ssl_capath
3.6.5
package_length_func
4.1.1
Coroutine::getuid
4.1.2
Coroutine::create
4.1.3
Coroutine::resume
4.1.4
Coroutine::suspend
4.1.5
Coroutine::fread
4.1.6
Coroutine::fgets
4.1.7
Coroutine::fwrite
4.1.8
Coroutine::sleep
4.1.9
Coroutine::gethostbyname
4.1.10
Coroutine::getaddrinfo
4.1.11
Coroutine::exec
4.1.12
Coroutine::readFile
4.1.13
Coroutine::writeFile
4.1.14
Coroutine::stats
4.1.15
Coroutine::getBackTrace
4.1.16
Coroutine::listCoroutines
4.2.1
Coroutine\Channel->__construct
4.2.2
Coroutine\Channel->push
4.2.3
Coroutine\Channel->pop
4.2.4
Coroutine\Channel->stats
4.2.5
Coroutine\Channel->close
4.2.6
Coroutine\Channel->length
4.2.7
Coroutine\Channel->isEmpty
4.2.8
Coroutine\Channel->isFull
4.2.9
Coroutine\Channel->$capacity
4.2.10
Coroutine\Channel->$errCode
4.3.1
Coroutine\Client->connect
4.3.2
Coroutine\Client->send
4.3.3
Coroutine\Client->recv
4.3.4
Coroutine\Client->close
4.3.5
Coroutine\Client->peek
4.4.1
属性列表
4.4.2
Coroutine\Http\Client->get
4.4.3
Coroutine\Http\Client->post
4.4.4
Coroutine\Http\Client->upgrade
4.4.5
Coroutine\Http\Client->push
4.4.6
Coroutine\Http\Client->recv
4.4.7
Coroutine\Http\Client->addFile
4.4.8
Coroutine\Http\Client->addData
4.4.9
Coroutine\Http\Client->download
4.7.1
Coroutine\Socket::__construct
4.7.2
Coroutine\Socket->bind
4.7.3
Coroutine\Socket->listen
4.7.4
Coroutine\Socket->accept
4.7.5
Coroutine\Socket->connect
4.7.6
Coroutine\Socket->send
4.7.7
Coroutine\Socket->recv
4.7.8
Coroutine\Socket->sendto
4.7.9
Coroutine\Socket->recvfrom
4.7.10
Coroutine\Socket->getsockname
4.7.11
Coroutine\Socket->getpeername
4.7.12
Coroutine\Socket->close
4.8.1
属性列表
4.8.2
Coroutine\MySQL->connect
4.8.3
Coroutine\MySQL->query
4.8.4
Coroutine\MySQL->prepare
4.8.5
Coroutine\MySQL\Statement->execute
4.8.6
Coroutine\MySQL\Statement->fetch
4.8.7
Coroutine\MySQL\Statement->fetchAll
4.8.8
Coroutine\MySQL\Statement->nextResult
4.8.9
Coroutine\MySQL->execFile
4.9.1
Coroutine\PostgreSQL->connect
4.9.2
Coroutine\PostgreSQL->query
4.9.3
Coroutine\PostgreSQL->fetchAll
4.9.4
Coroutine\PostgreSQL->affectedRows
4.9.5
Coroutine\PostgreSQL->numRows
4.9.6
Coroutine\PostgreSQL->fetchObject
4.9.7
Coroutine\PostgreSQL->fetchAssoc
4.9.8
Coroutine\PostgreSQL->fetchArray
4.9.9
Coroutine\PostgreSQL->fetchRow
4.9.10
Coroutine\PostgreSQL->metaData
4.13.1
协程与线程
4.13.2
发送数据协程调度
4.13.3
协程内存开销
4.13.4
4.0 协程实现原理
4.15.1
在多个协程间共用同一个协程客户端
4.15.2
禁止使用协程 API 的场景 (Swoole4以下版本)
4.15.3
使用类静态变量/全局变量保存上下文
4.17.1
MongoDB
5.1.1
swoole_async_readfile
5.1.2
swoole_async_writefile
5.1.3
swoole_async_read
5.1.4
swoole_async_write
5.1.5
swoole_async_dns_lookup
5.1.6
swoole_async::exec
5.2.1
swoole_event_add
5.2.2
swoole_event_set
5.2.3
swoole_event_isset
5.2.4
swoole_event_write
5.2.5
swoole_event_del
5.2.6
swoole_event_exit
5.2.7
swoole_event_defer
5.2.8
swoole_event_cycle
5.2.9
swoole_event_wait
5.2.10
swoole_event_dispatch
5.3.1
swoole_timer_tick
5.3.2
swoole_timer_after
5.3.3
swoole_timer_clear
5.4.1
swoole_mysql->__construct
5.4.2
swoole_mysql->on
5.4.3
swoole_mysql->connect
5.4.4
swoole_mysql->escape
5.4.5
swoole_mysql->query
5.4.6
swoole_mysql->begin
5.4.7
swoole_mysql->commit
5.4.8
swoole_mysql->rollback
5.4.9
swoole_mysql->close
5.5.1
swoole_redis->__construct
5.5.2
swoole_redis->on
5.5.3
swoole_redis->connect
5.5.4
swoole_redis->__call
5.5.5
swoole_redis->close
5.6.1
swoole_http_client->__construct
5.6.2
swoole_http_client->set
5.6.3
swoole_http_client->setMethod
5.6.4
swoole_http_client->setHeaders
5.6.5
swoole_http_client->setCookies
5.6.6
swoole_http_client->setData
5.6.7
swoole_http_client->addFile
5.6.8
swoole_http_client->get
5.6.9
swoole_http_client->post
5.6.10
swoole_http_client->upgrade
5.6.11
swoole_http_client->push
5.6.12
swoole_http_client->execute
5.6.13
swoole_http_client->download
5.6.14
swoole_http_client->close
6.1.1
swoole_lock->__construct
6.1.2
swoole_lock->lock
6.1.3
swoole_lock->trylock
6.1.4
swoole_lock->unlock
6.1.5
swoole_lock->lock_read
6.1.6
swoole_lock->trylock_read
6.1.7
swoole_lock->lockwait
6.2.1
swoole_buffer->__construct
6.2.2
swoole_buffer->append
6.2.3
swoole_buffer->substr
6.2.4
swoole_buffer->clear
6.2.5
swoole_buffer->expand
6.2.6
swoole_buffer->write
6.2.7
swoole_buffer->read
6.2.8
swoole_buffer->recycle
6.3.1
swoole_table->__construct
6.3.2
swoole_table->column
6.3.3
swoole_table->create
6.3.4
swoole_table->set
6.3.5
swoole_table->incr
6.3.6
swoole_table->decr
6.3.7
swoole_table->get
6.3.8
swoole_table->exist
6.3.9
swoole_table->del
6.3.10
常量列表
6.3.11
swoole_table->count
6.4.1
swoole_atomic->__construct
6.4.2
swoole_atomic->add
6.4.3
swoole_atomic->sub
6.4.4
swoole_atomic->get
6.4.5
swoole_atomic->set
6.4.6
swoole_atomic->cmpset
6.4.7
swoole_atomic->wait
6.4.8
swoole_atomic->wakeup
6.5.1
swoole_mmap::open
6.6.1
Channel->__construct
6.6.2
Channel->push
6.6.3
Channel->pop
6.6.4
Channel->stats
6.7.1
swoole_serialize::pack
6.7.2
swoole_serialize::unpack
8.1.1
swoole_http_server->on
8.1.2
swoole_http_server->start
8.3.1
swoole_http_response->header
8.3.2
swoole_http_response->cookie
8.3.3
swoole_http_response->status
8.3.4
swoole_http_response->gzip
8.3.5
swoole_http_response->redirect
8.3.6
swoole_http_response->write
8.3.7
swoole_http_response->sendfile
8.3.8
swoole_http_response->end
8.3.9
swoole_http_response->detach
8.3.10
swoole_http_response::create
8.4.1
upload_tmp_dir
8.4.2
http_parse_post
8.4.3
document_root
8.4.4
http_compression
8.5.1
CURL发送POST请求服务器端超时
8.5.2
使用Chrome访问服务器会产生2次请求
8.5.3
GET/POST请求的最大尺寸
9.1.1
onHandShake
9.1.2
onOpen
9.1.3
onMessage
11.1.1
setHandler
11.1.2
format
12.13.1
队列(Queue)
12.13.2
堆(Heap)
12.13.3
定长数组(SplFixedArray)
13.1.1
swoole_set_process_name
13.1.2
swoole_version
13.1.3
swoole_strerror
13.1.4
swoole_errno
13.1.5
swoole_get_local_ip
13.1.6
swoole_clear_dns_cache
13.1.7
swoole_get_local_mac
13.1.8
swoole_cpu_num
13.15.1
swoole_server->handler
13.15.2
task_worker_max
13.15.3
swoole_server->addtimer
13.15.4
swoole_server->deltimer
13.15.5
onTimer
13.15.6
swoole_timer_add
13.15.7
swoole_timer_del
13.15.8
swoole_get_mysqli_sock
13.15.9
swoole_mysql_query
13.15.10
onMasterConnect
13.15.11
onMasterClose
13.15.12
Nginx/Golang/Swoole/Node.js的性能对比
13.15.13
Coroutine::call_user_func
13.15.14
Coroutine::call_user_func_array
13.15.15
Coroutine\Channel::select
13.16.1
1.10.3
13.16.2
1.10.2
13.16.3
1.10.1
13.16.4
1.10.0
13.16.5
1.9.23
13.16.6
1.9.22
13.16.7
1.9.19
13.16.8
1.9.18
13.16.9
1.9.17
13.16.10
1.9.16
13.16.11
1.9.15
13.16.12
1.9.14
13.16.13
1.9.12
13.16.14
1.9.11
13.16.15
1.9.9
13.16.16
1.9.7
13.16.17
1.9.6
13.16.18
1.9.5
13.16.19
1.9.4
13.16.20
1.9.3
13.16.21
1.9.2
13.16.22
1.9.1
13.16.23
1.9.0
13.16.24
1.8.13
13.16.25
1.8.12
13.16.26
1.8.11
13.16.27
1.8.10
13.16.28
1.8.9
13.16.29
1.8.8
13.16.30
1.8.7
13.16.31
1.8.6
13.16.32
1.8.5
13.16.33
1.8.4
13.16.34
1.8.3
13.16.35
1.8.2
13.16.36
1.8.1
13.16.37
1.8.0
13.16.38
1.7.22
13.16.39
1.7.21
13.16.40
1.7.20
13.16.41
1.7.19
13.16.42
1.7.18
13.16.43
1.7.17
13.16.44
1.7.16
13.16.45
1.7.15
13.16.46
1.7.14
13.16.47
1.7.13
13.16.48
1.7.12
13.16.49
1.7.11
13.16.50
1.7.10
13.16.51
1.7.9
13.16.52
1.7.8
13.16.53
1.7.7
13.16.54
1.7.6
13.16.55
1.7.5
13.16.56
v1.5
13.16.57
v1.6
13.16.58
v1.7