Ref/swoole-funcs-Phpdoc专题
swoole_async_dns_lookup
Async and non-blocking hostname to IP lookup
说明
bool <span
class="methodname">swoole_async_dns_lookup ( <span
class="methodparam">string $hostname
, callable
$callback )
参数
hostname
The host name.
callback
mixed <span
class="replaceable">callback ( <span
class="methodparam">string $hostname
, string
$ip )
hostname
The host name.
IP
The IP address.
返回值
成功时返回 true, 或者在失败时返回 false。
swoole_async_read
Read file stream asynchronously
说明
bool <span
class="methodname">swoole_async_read ( <span
class="methodparam">string $filename
, callable
$callback [, <span
class="type">int $chunk_size =
65536 [, <span
class="type">int $offset =
0 ]] )
参数
filename
The filename of the file being read.
callback
mixed <span
class="replaceable">callback ( <span
class="methodparam">string $filename
, string
$content )
filename
The name of the file.
content
The content readed from the file stream.
chunk_size
The chunk length.
offset
The offset.
返回值
Whether the read is succeed.
swoole_async_readfile
Read a file asynchronously
说明
bool <span
class="methodname">swoole_async_readfile ( <span
class="methodparam">string $filename
, callable
$callback )
参数
filename
The filename of the file being read.
callback
mixed <span
class="replaceable">callback ( <span
class="methodparam">string $filename
, string
$content )
filename
The name of the file.
content
The content readed from the file.
返回值
成功时返回 true, 或者在失败时返回 false。
swoole_async_set
Update the async I/O options
说明
void <span
class="methodname">swoole_async_set ( <span
class="methodparam">array $settings )
参数
settings
swoole_async_write
Write data to a file stream asynchronously
说明
bool <span
class="methodname">swoole_async_write ( <span
class="methodparam">string $filename
, string
$content [, <span
class="type">int $offset [, <span
class="methodparam">callable
$callback ]] )
参数
filename
The filename being written.
content
The content writing to the file.
offset
The offset.
callback
返回值
成功时返回 true, 或者在失败时返回 false。
swoole_async_writefile
Write data to a file asynchronously
说明
bool <span
class="methodname">swoole_async_writefile ( <span
class="methodparam">string $filename
, string
$content [, <span
class="type">callable $callback [, <span
class="methodparam">int $flags<span
class="initializer"> = 0 ]] )
参数
filename
The filename being written.
content
The content writing to the file.
callback
flags
返回值
成功时返回 true, 或者在失败时返回 false。
swoole_client_select
Get the file description which are ready to read/write or error
说明
int <span
class="methodname">swoole_client_select ( <span
class="methodparam">array
&$read_array , <span
class="type">array &$write_array , <span
class="methodparam">array
&$error_array [, <span
class="type">float $timeout =
0.5 ] )
参数
read_array
write_array
error_array
timeout
返回值
swoole_cpu_num
Get the number of CPU
说明
int <span class="methodname">swoole_cpu_num ( <span class="methodparam">void )
参数
此函数没有参数。
返回值
The number of CPU.
swoole_errno
Get the error code of the latest system call
说明
int <span class="methodname">swoole_errno ( <span class="methodparam">void )
参数
此函数没有参数。
返回值
swoole_event_add
Add new callback functions of a socket into the EventLoop
说明
int <span
class="methodname">swoole_event_add ( <span
class="methodparam">int $fd [, <span
class="methodparam">callable
$read_callback [, <span
class="type">callable $write_callback [, <span
class="methodparam">int $events<span
class="initializer"> = 0 ]]] )
参数
fd
read_callback
write_callback
events
返回值
swoole_event_defer
Add callback function to the next event loop
说明
bool <span
class="methodname">swoole_event_defer ( <span
class="methodparam">callable
$callback )
参数
callback
返回值
成功时返回 true, 或者在失败时返回 false。
swoole_event_del
Remove all event callback functions of a socket
说明
bool <span
class="methodname">swoole_event_del ( <span
class="methodparam">int $fd )
参数
fd
返回值
成功时返回 true, 或者在失败时返回 false。
swoole_event_exit
Exit the eventloop, only available at the client side
说明
void <span class="methodname">swoole_event_exit ( <span class="methodparam">void )
参数
此函数没有参数。
返回值
swoole_event_set
Update the event callback functions of a socket
说明
bool <span
class="methodname">swoole_event_set ( <span
class="methodparam">int $fd [, <span
class="methodparam">callable
$read_callback [, <span
class="type">callable $write_callback [, <span
class="methodparam">int $events<span
class="initializer"> = 0 ]]] )
参数
fd
read_callback
write_callback
events
返回值
swoole_event_wait
Start the event loop
说明
void <span class="methodname">swoole_event_wait ( <span class="methodparam">void )
参数
此函数没有参数。
返回值
swoole_event_write
Write data to a socket
说明
bool <span
class="methodname">swoole_event_write ( <span
class="methodparam">int $fd , <span
class="methodparam">string $data )
参数
fd
data
返回值
成功时返回 true, 或者在失败时返回 false。
swoole_get_local_ip
Get the IPv4 IP addresses of each NIC on the machine
说明
array <span class="methodname">swoole_get_local_ip ( <span class="methodparam">void )
参数
此函数没有参数。
返回值
swoole_last_error
Get the lastest error message
说明
int <span class="methodname">swoole_last_error ( <span class="methodparam">void )
参数
此函数没有参数。
返回值
swoole_load_module
Load a swoole extension
说明
mixed <span
class="methodname">swoole_load_module ( <span
class="methodparam">string $filename
)
参数
此函数没有参数。
返回值
swoole_select
Select the file descriptions which are ready to read/write or error in the eventloop
说明
int <span
class="methodname">swoole_select ( <span
class="methodparam">array
&$read_array , <span
class="type">array &$write_array , <span
class="methodparam">array
&$error_array [, <span
class="type">float $timeout ] )
参数
read_array
write_array
error_array
timeout
返回值
swoole_set_process_name
Set the process name
说明
void <span
class="methodname">swoole_set_process_name ( <span
class="methodparam">string
$process_name [, <span
class="type">int $size =
128 ] )
参数
process_name
返回值
swoole_strerror
Convert the Errno into error messages
说明
string <span
class="methodname">swoole_strerror ( <span
class="methodparam">int $errno [,
int
$error_type = 0 ] )
参数
errno
返回值
swoole_timer_after
Trigger a one time callback function in the future
说明
int <span
class="methodname">swoole_timer_after ( <span
class="methodparam">int $ms , <span
class="methodparam">callable
$callback [, <span
class="type">mixed $param ] )
参数
ms
callback
param
返回值
swoole_timer_exists
Check if a timer callback function is existed
说明
bool <span
class="methodname">swoole_timer_exists ( <span
class="methodparam">int $timer_id )
参数
timer_id
返回值
swoole_timer_tick
Trigger a timer tick callback function by time interval
说明
int <span
class="methodname">swoole_timer_tick ( <span
class="methodparam">int $ms , <span
class="methodparam">callable
$callback [, <span
class="type">mixed $param ] )
参数
ms
callback
返回值
swoole_version
Get the version of Swoole
说明
string <span class="methodname">swoole_version ( <span class="methodparam">void )
参数
此函数没有参数。
返回值
The version of 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