当前位置:首页 > PHP

PHP

  • 最新
  • 浏览
  • 评论

php socket_import_stream函数的用法

高老师5年前 (2020-09-17)1423
php socket_import_stream函数的用法
socket_import_stream函数可以将使用stream_socket_server创建stream socket句柄转换为标准的socket句柄,因为标准socket支持更多的配置选项。在workerman中有如下代码:if (function_exists('sock...

php is_dir函数结果不准确,php file_exists函数结果不准确,php is_file函数结果不准确

高老师5年前 (2020-09-11)1427
php is_dir函数结果不准确,php file_exists函数结果不准确,php is_file函数结果不准确
php中stat(), lstat(), file_exists(), is_writable(), is_readable(), is_executable(), is_file(), is_dir(), is_link(), filectime(), fileatime(), filemtime...

php序列化闭包函数,php反序列化闭包函数,php如何序列化/存储闭包(Closure)

高老师5年前 (2020-09-05)2110
php序列化闭包函数,php反序列化闭包函数,php如何序列化/存储闭包(Closure)
由于需要为自己的php守护进程投递闭包函数来执行,但是发现php官方根本没有提供php闭包函数的序列化功能。后来在mixphp文档发现了mixphp支持异步进程执行投递的闭包函数才发现了一个神奇的php闭包函数序列化composer包(1).安装序列化composer包composer r...

php设置进程标题,php设置进程名称

高老师5年前 (2020-09-02)1270
php设置进程标题,php设置进程名称
    /**      * 设置进程标题      * @param string $title  &nbs...

php stream_set_blocking设置非阻塞模式,php stream_set_blocking影响函数fgets()和fread()

高老师5年前 (2020-09-02)1687
php stream_set_blocking设置非阻塞模式,php stream_set_blocking影响函数fgets()和fread()
stream_set_blocking函数可以将资源流设置为阻塞模式或者非阻塞模式,主要影响的函数分别是fgets,fread,其他的手册没有说。在socket编程中,如果一个socket连接上了,但是不发送数据,此时使用fread或者fgets去读取数据,由于socket句柄是有效的,但是获取不到...

php feof使用注意,php feof socket套接字使用注意,

高老师5年前 (2020-09-02)1199
php feof使用注意,php feof socket套接字使用注意,
服务端:<?php $socket = stream_socket_server('tcp://127.0.0.1:8888', $errno, $errstr); while ($conn = stream...

Benchmarking 127.0.0.1 (be patient)...apr_socket_recv

高老师5年前 (2020-08-31)1507
Benchmarking 127.0.0.1 (be patient)...apr_socket_recv
当我用ab进行对php socket代码进行并发测试出现问题,经过排查是我直接对客户端进行发送消息,没有先读取客户端消息造成的。    $text = "hello world" . PHP_EOL;...

php socket select poll epoll

高老师5年前 (2020-08-31)1199
php socket select poll epoll
【一】....

stream_socket_accept peername和stream_socket_get_name

高老师5年前 (2020-08-30)1071
stream_socket_accept  peername和stream_socket_get_name
stream_socket_accept  $peername参数将对应客户端的地址和端口输出:$conn = stream_socket_accept($socket,0,$peerName);127.0.0.1:57034输出连接的客户端的ip和端口而stream_...

stream_socket_accept设置非阻塞,socket_accept设置非阻塞

高老师5年前 (2020-08-30)1523
stream_socket_accept设置非阻塞,socket_accept设置非阻塞
编写socket服务检测是否有新连接加入都要使用stream_socket_accept和socket_accept来获取,但是默认是阻塞的,想要更换为非阻塞并不能用stream_set_blocking($socket, false),因为stream_set_blocking只是设置socket...