streamWrapper 类

(PHP 4 >= 4.3.2, PHP 5, PHP 7, PHP 8)

简介

允许实现自定义协议处理程序和流,以便与其它文件系统函数(比如 fopen()fread() 等)一起使用。

注意:

不是真实的类,只是如何定义协议的原型类。

注意:

不使用此处描述的方法而使用其它方式可能会导致未定义行为。

一旦流函数尝试访问与其关联的协议,就会初始化此类的实例。

类摘要

class streamWrapper {
/* 属性 */
/* 方法 */
public function __construct()
public function dir_closedir(): bool
public function dir_opendir(string $path, int $options): bool
public function dir_readdir(): string|bool
public function dir_rewinddir(): bool
public function mkdir(string $path, int $mode, int $options): bool
public function rename(string $path_from, string $path_to): bool
public function rmdir(string $path, int $options): bool
public function stream_cast(int $cast_as): resource|false
public function stream_close(): void
public function stream_eof(): bool
public function stream_flush(): bool
public function stream_lock(int $operation): bool
public function stream_metadata(string $path, int $option, mixed $value): bool
public function stream_open(
    string $path,
    string $mode,
    int $options,
    ?string &$opened_path
): bool
public function stream_read(int $count): string|false
public function stream_seek(int $offset, int $whence): bool
public function stream_set_option(int $option, int $arg1, int $arg2): bool
public function stream_stat(): array|false
public function stream_tell(): int
public function stream_truncate(int $new_size): bool
public function stream_write(string $data): int
public function unlink(string $path): bool
public function url_stat(string $path, int $flags): array|false
public function __destruct()
}

属性

资源 context

当前 context,或者没有 context 传递给调用函数,则为 null

使用 stream_context_get_options() 解析 context。

注意:

此属性必须是 public,以便 PHP 可以使用使用实际的 context 资源填充它。

目录