API Reference Document
« stream_wrapper_unregister
简介 »
PHP Manual
其它基本扩展
Swoole
Swoole
简介
安装/配置
需求
安装
运行时配置
资源类型
预定义常量
Swoole 函数
swoole_async_dns_lookup
— Async and non-blocking hostname to IP lookup
swoole_async_read
— Read file stream asynchronously
swoole_async_readfile
— Read a file asynchronously
swoole_async_set
— Update the async I/O options
swoole_async_write
— Write data to a file stream asynchronously
swoole_async_writefile
— Write data to a file asynchronously
swoole_client_select
— Get the file description which are ready to read/write or error
swoole_cpu_num
— Get the number of CPU
swoole_errno
— Get the error code of the latest system call
swoole_event_add
— Add new callback functions of a socket into the EventLoop
swoole_event_defer
— Add callback function to the next event loop
swoole_event_del
— Remove all event callback functions of a socket
swoole_event_exit
— Exit the eventloop, only available at the client side
swoole_event_set
— Update the event callback functions of a socket
swoole_event_wait
— Start the event loop
swoole_event_write
— Write data to a socket
swoole_get_local_ip
— Get the IPv4 IP addresses of each NIC on the machine
swoole_last_error
— Get the lastest error message
swoole_load_module
— Load a swoole extension
swoole_select
— Select the file descriptions which are ready to read/write or error in the eventloop
swoole_set_process_name
— Set the process name
swoole_strerror
— Convert the Errno into error messages
swoole_timer_after
— Trigger a one time callback function in the future
swoole_timer_exists
— Check if a timer callback function is existed
swoole_timer_tick
— Trigger a timer tick callback function by time interval
swoole_version
— Get the version of Swoole
Swoole\Async
— The Swoole\Async class
Swoole\Async::dnsLookup
— Async and non-blocking hostname to IP lookup.
Swoole\Async::read
— Read file stream asynchronously.
Swoole\Async::readFile
— Read a file asynchronously.
Swoole\Async::set
— Update the async I/O options.
Swoole\Async::write
— Write data to a file stream asynchronously.
Swoole\Async::writeFile
— Description
Swoole\Atomic
— The Swoole\Atomic class
Swoole\Atomic::add
— Add a number to the value to the atomic object.
Swoole\Atomic::cmpset
— Compare and set the value of the atomic object.
Swoole\Atomic::__construct
— Construct a swoole atomic object.
Swoole\Atomic::get
— Get the current value of the atomic object.
Swoole\Atomic::set
— Set a new value to the atomic object.
Swoole\Atomic::sub
— Subtract a number to the value of the atomic object.
Swoole\Buffer
— The Swoole\Buffer class
Swoole\Buffer::append
— Append the string or binary data at the end of the memory buffer and return the new size of memory allocated.
Swoole\Buffer::clear
— Reset the memory buffer.
Swoole\Buffer::__construct
— Fixed size memory blocks allocation.
Swoole\Buffer::__destruct
— Destruct the Swoole memory buffer.
Swoole\Buffer::expand
— Expand the size of memory buffer.
Swoole\Buffer::read
— Read data from the memory buffer based on offset and length.
Swoole\Buffer::recycle
— Release the memory to OS which is not used by the memory buffer.
Swoole\Buffer::substr
— Read data from the memory buffer based on offset and length. Or remove data from the memory buffer.
Swoole\Buffer::__toString
— Get the string value of the memory buffer.
Swoole\Buffer::write
— Write data to the memory buffer. The memory allocated for the buffer will not be changed.
Swoole\Channel
— The Swoole\Channel class
Swoole\Channel::__construct
— Construct a Swoole Channel
Swoole\Channel::__destruct
— Destruct a Swoole channel.
Swoole\Channel::pop
— Read and pop data from swoole channel.
Swoole\Channel::push
— Write and push data into Swoole channel.
Swoole\Channel::stats
— Get stats of swoole channel.
Swoole\Client
— The Swoole\Client class
Swoole\Client::close
— Close the connection established.
Swoole\Client::connect
— Connect to the remote TCP or UDP port.
Swoole\Client::__construct
— Create Swoole sync or async TCP/UDP client, with or without SSL.
Swoole\Client::__destruct
— Destruct the Swoole client.
Swoole\Client::getpeername
— Get the remote socket name of the connection.
Swoole\Client::getsockname
— Get the local socket name of the connection.
Swoole\Client::isConnected
— Check if the connection is established.
Swoole\Client::on
— Add callback functions triggered by events.
Swoole\Client::pause
— Pause receiving data.
Swoole\Client::pipe
— Redirect the data to another file descriptor.
Swoole\Client::recv
— Receive data from the remote socket.
Swoole\Client::resume
— Resume receiving data.
Swoole\Client::send
— Send data to the remote TCP socket.
Swoole\Client::sendfile
— Send file to the remote TCP socket.
Swoole\Client::sendto
— Send data to the remote UDP address.
Swoole\Client::set
— Set the Swoole client parameters before the connection is established.
Swoole\Client::sleep
— Remove the TCP client from system event loop.
Swoole\Client::wakeup
— Add the TCP client back into the system event loop.
Swoole\Connection\Iterator
— The Swoole\Connection\Iterator class
Swoole\Connection\Iterator::count
— Count connections.
Swoole\Connection\Iterator::current
— Return current connection entry.
Swoole\Connection\Iterator::key
— Return key of the current connection.
Swoole\Connection\Iterator::next
— Move to the next connection.
Swoole\Connection\Iterator::offsetExists
— Check if offet exists.
Swoole\Connection\Iterator::offsetGet
— Offset to retrieve.
Swoole\Connection\Iterator::offsetSet
— Assign a Connection to the specified offset.
Swoole\Connection\Iterator::offsetUnset
— Unset an offset.
Swoole\Connection\Iterator::rewind
— Rewinds iterator
Swoole\Connection\Iterator::valid
— Check if current position is valid.
Swoole\Coroutine
— The Swoole\Coroutine class
Swoole\Coroutine::call_user_func_array
— Call a callback with an array of parameters
Swoole\Coroutine::call_user_func
— Call a callback given by the first parameter
Swoole\Coroutine::cli_wait
— Description
Swoole\Coroutine::create
— Description
Swoole\Coroutine\Client::close
— Description
Swoole\Coroutine\Client::connect
— Description
Swoole\Coroutine\Client::__construct
— Description
Swoole\Coroutine\Client::__destruct
— Description
Swoole\Coroutine\Client::getpeername
— Description
Swoole\Coroutine\Client::getsockname
— Description
Swoole\Coroutine\Client::isConnected
— Description
Swoole\Coroutine\Client::recv
— Description
Swoole\Coroutine\Client::send
— Description
Swoole\Coroutine\Client::sendfile
— Description
Swoole\Coroutine\Client::sendto
— Description
Swoole\Coroutine\Client::set
— Description
Swoole\Coroutine\Http\Client::addFile
— Description
Swoole\Coroutine\Http\Client::close
— Description
Swoole\Coroutine\Http\Client::__construct
— Description
Swoole\Coroutine\Http\Client::__destruct
— Description
Swoole\Coroutine\Http\Client::execute
— Description
Swoole\Coroutine\Http\Client::get
— Description
Swoole\Coroutine\Http\Client::getDefer
— Description
Swoole\Coroutine\Http\Client::isConnected
— Description
Swoole\Coroutine\Http\Client::post
— Description
Swoole\Coroutine\Http\Client::recv
— Description
Swoole\Coroutine\Http\Client::set
— Description
Swoole\Coroutine\Http\Client::setCookies
— Description
Swoole\Coroutine\Http\Client::setData
— Description
Swoole\Coroutine\Http\Client::setDefer
— Description
Swoole\Coroutine\Http\Client::setHeaders
— Description
Swoole\Coroutine\Http\Client::setMethod
— Description
Swoole\Coroutine\MySQL::close
— Description
Swoole\Coroutine\MySQL::connect
— Description
Swoole\Coroutine\MySQL::__construct
— Description
Swoole\Coroutine\MySQL::__destruct
— Description
Swoole\Coroutine\MySQL::getDefer
— Description
Swoole\Coroutine\MySQL::query
— Description
Swoole\Coroutine\MySQL::recv
— Description
Swoole\Coroutine\MySQL::setDefer
— Description
Swoole\Coroutine::getuid
— Description
Swoole\Coroutine::resume
— Description
Swoole\Coroutine::suspend
— Description
Swoole\Event
— The Swoole\Event class
Swoole\Event::add
— Add new callback functions of a socket into the EventLoop.
Swoole\Event::defer
— Add a callback function to the next event loop.
Swoole\Event::del
— Remove all event callback functions of a socket.
Swoole\Event::exit
— Exit the eventloop, only available at client side.
Swoole\Event::set
— Update the event callback functions of a socket.
Swoole\Event::wait
— Description
Swoole\Event::write
— Write data to the socket.
Swoole\Exception
— The Swoole\Exception class
Swoole\Http\Client
— The Swoole\Http\Client class
Swoole\Http\Client::addFile
— Add a file to the post form.
Swoole\Http\Client::close
— Close the http connection.
Swoole\Http\Client::__construct
— Construct the async HTTP client.
Swoole\Http\Client::__destruct
— Destruct the HTTP client.
Swoole\Http\Client::download
— Download a file from the remote server.
Swoole\Http\Client::execute
— Send the HTTP request after setting the parameters.
Swoole\Http\Client::get
— Send GET http request to the remote server.
Swoole\Http\Client::isConnected
— Check if the HTTP connection is connected.
Swoole\Http\Client::on
— Register callback function by event name.
Swoole\Http\Client::post
— Send POST http request to the remote server.
Swoole\Http\Client::push
— Push data to websocket client.
Swoole\Http\Client::set
— Update the HTTP client paramters.
Swoole\Http\Client::setCookies
— Set the http request cookies.
Swoole\Http\Client::setData
— Set the HTTP request body data.
Swoole\Http\Client::setHeaders
— Set the HTTP request headers.
Swoole\Http\Client::setMethod
— Set the HTTP request method.
Swoole\Http\Client::upgrade
— Upgrade to websocket protocol.
Swoole\Http\Request
— The Swoole\Http\Request class
Swoole\Http\Request::__destruct
— Destruct the HTTP request.
Swoole\Http\Request::rawcontent
— Get the raw HTTP POST body.
Swoole\Http\Response
— The Swoole\Http\Response class
Swoole\Http\Response::cookie
— Set the cookies of the HTTP response.
Swoole\Http\Response::__destruct
— Destruct the HTTP response.
Swoole\Http\Response::end
— Send data for the HTTP request and finish the response.
Swoole\Http\Response::gzip
— Enable the gzip of response content.
Swoole\Http\Response::header
— Set the HTTP response headers.
Swoole\Http\Response::initHeader
— Init the HTTP response header.
Swoole\Http\Response::rawcookie
— Set the raw cookies to the HTTP response.
Swoole\Http\Response::sendfile
— Send file through the HTTP response.
Swoole\Http\Response::status
— Set the status code of the HTTP response.
Swoole\Http\Response::write
— Append HTTP body content to the HTTP response.
Swoole\Http\Server
— The Swoole\Http\Server class
Swoole\Http\Server::on
— Bind callback function to HTTP server by event name.
Swoole\Http\Server::start
— Start the swoole http server.
Swoole\Lock
— The Swoole\Lock class
Swoole\Lock::__construct
— Construct a memory lock.
Swoole\Lock::__destruct
— Destory a Swoole memory lock.
Swoole\Lock::lock_read
— Lock a read-write lock for reading.
Swoole\Lock::lock
— Try to acquire the lock. It will block if the lock is not available.
Swoole\Lock::trylock_read
— Try to lock a read-write lock for reading and return straight away even the lock is not available.
Swoole\Lock::trylock
— Try to acquire the lock and return straight away even the lock is not available.
Swoole\Lock::unlock
— Release the lock.
Swoole\Mmap
— The Swoole\Mmap class
Swoole\Mmap::open
— Map a file into memory and return the stream resource which can be used by PHP stream operations.
Swoole\MySQL
— The Swoole\MySQL class
Swoole\MySQL::close
— Close the async MySQL connection.
Swoole\MySQL::connect
— Connect to the remote MySQL server.
Swoole\MySQL::__construct
— Construct an async MySQL client.
Swoole\MySQL::__destruct
— Destory the async MySQL client.
Swoole\MySQL::getBuffer
— Description
Swoole\MySQL::on
— Register callback function based on event name.
Swoole\MySQL::query
— Run the SQL query.
Swoole\MySQL\Exception
— The Swoole\MySQL\Exception class
Swoole\Process
— The Swoole\Process class
Swoole\Process::alarm
— High precision timer which triggers signal with fixed interval.
Swoole\Process::close
— Close the pipe to the child process.
Swoole\Process::__construct
— Construct a process.
Swoole\Process::daemon
— Change the process to be a daemon process.
Swoole\Process::__destruct
— Destory the process.
Swoole\Process::exec
— Execute system commands.
Swoole\Process::exit
— Stop the child processes.
Swoole\Process::freeQueue
— Destory the message queue created by swoole_process::useQueue.
Swoole\Process::kill
— Send signal to the child process.
Swoole\Process::name
— Set name of the process.
Swoole\Process::pop
— Read and pop data from the message queue.
Swoole\Process::push
— Write and push data into the message queue.
Swoole\Process::read
— Read data sending to the process.
Swoole\Process::signal
— Send signal to the child processes.
Swoole\Process::start
— Start the process.
Swoole\Process::statQueue
— Get the stats of the message queue used as the communication method between processes.
Swoole\Process::useQueue
— Create a message queue as the communication method between the parent process and child processes.
Swoole\Process::wait
— Wait for the events of child processes.
Swoole\Process::write
— Write data into the pipe and communicate with the parent process or child processes.
Swoole\Redis\Server
— The Swoole\Redis\Server class
Swoole\Redis\Server::format
— Description
Swoole\Redis\Server::setHandler
— Description
Swoole\Redis\Server::start
— Description
Swoole\Serialize
— The Swoole\Serialize class
Swoole\Serialize::pack
— Serialize the data.
Swoole\Serialize::unpack
— Unserialize the data.
Swoole\Server
— The Swoole\Server class
Swoole\Server::addlistener
— Add a new listener to the server.
Swoole\Server::addProcess
— Add a user defined swoole_process to the server.
Swoole\Server::after
— Trigger a callback function after a period of time.
Swoole\Server::bind
— Bind the connection to a user defined user ID.
Swoole\Server::clearTimer
— Stop and destory a timer.
Swoole\Server::close
— Close a connection to the client.
Swoole\Server::confirm
— Check status of the connection.
Swoole\Server::connection_info
— Get the connection info by file description.
Swoole\Server::connection_list
— Get all of the established connections.
Swoole\Server::__construct
— Construct a Swoole server.
Swoole\Server::defer
— Delay execution of the callback function at the end of current EventLoop.
Swoole\Server\Port::__construct
— Construct a server port
Swoole\Server\Port::__destruct
— Destory server port
Swoole\Server\Port::on
— Register callback functions by event.
Swoole\Server\Port::set
— Set protocol of the server port.
Swoole\Server::exist
— Check if the connection is existed.
Swoole\Server::finish
— Used in task process for sending result to the worker process when the task is finished.
Swoole\Server::getClientInfo
— Get the connection info by file description.
Swoole\Server::getClientList
— Get all of the established connections.
Swoole\Server::getLastError
— Get the error code of the most recent error.
Swoole\Server::heartbeat
— Check all the connections on the server.
Swoole\Server::listen
— Listen on the given IP and port, socket type.
Swoole\Server::on
— Register a callback function by event name.
Swoole\Server::pause
— Stop receiving data from the connection.
Swoole\Server::protect
— Set the connection to be protected mode.
Swoole\Server::reload
— Restart all the worker process.
Swoole\Server::resume
— Start receving data from the connection.
Swoole\Server::send
— Send data to the client.
Swoole\Server::sendfile
— Send file to the connection.
Swoole\Server::sendMessage
— Send message to worker processes by ID.
Swoole\Server::sendto
— Send data to the remote UDP address.
Swoole\Server::sendwait
— Send data to the remote socket in the blocking way.
Swoole\Server::set
— Set the runtime settings of the swoole server.
Swoole\Server::shutdown
— Shutdown the master server process, this function can be called in worker processes.
Swoole\Server::start
— Start the Swoole server.
Swoole\Server::stats
— Get the stats of the Swoole server.
Swoole\Server::stop
— Stop the Swoole server.
Swoole\Server::task
— Send data to the task worker processes.
Swoole\Server::taskwait
— Send data to the task worker processes in blocking way.
Swoole\Server::taskWaitMulti
— Execute multiple tasks concurrently.
Swoole\Server::tick
— Repeats a given function at every given time-interval.
Swoole\Table
— The Swoole\Table class
Swoole\Table::column
— Set the data type and size of the columns.
Swoole\Table::__construct
— Construct a Swoole memory table with fixed size.
Swoole\Table::count
— Count the rows in the table, or count all the elements in the table if $mode = 1.
Swoole\Table::create
— Create the swoole memory table.
Swoole\Table::current
— Get the current row.
Swoole\Table::decr
— Decrement the value in the Swoole table by $row_key and $column_key.
Swoole\Table::del
— Delete a row in the Swoole table by $row_key.
Swoole\Table::destroy
— Destroy the Swoole table.
Swoole\Table::exist
— Check if a row is existed by $row_key.
Swoole\Table::get
— Get the value in the Swoole table by $row_key and $column_key.
Swoole\Table::incr
— Increment the value by $row_key and $column_key.
Swoole\Table::key
— Get the key of current row.
Swoole\Table::next
— Iterator the next row.
Swoole\Table::rewind
— Rewind the iterator.
Swoole\Table::set
— Update a row of the table by $row_key.
Swoole\Table::valid
— Check current if the current row is valid.
Swoole\Timer
— The Swoole\Timer class
Swoole\Timer::after
— Trigger a callback function after a period of time.
Swoole\Timer::clear
— Delete a timer by timer ID.
Swoole\Timer::exists
— Check if a timer is existed.
Swoole\Timer::tick
— Repeats a given function at every given time-interval.
Swoole\WebSocket\Frame
— The Swoole\WebSocket\Frame class
Swoole\WebSocket\Server
— The Swoole\WebSocket\Server class
Swoole\WebSocket\Server::exist
— Check if the file descriptor exists.
Swoole\WebSocket\Server::on
— Register event callback function
Swoole\WebSocket\Server::pack
— Get a pack of binary data to send in a single frame.
Swoole\WebSocket\Server::push
— Push data to the remote client.
Swoole\WebSocket\Server::unpack
— Unpack the binary data received from the client.