大网数据广告活动
PHP 语言与运行手册

posix_fpathconf · Returns the value of a configurable limit

· 52CE 我爱测

posix_fpathconf — Returns the value of a configurable limit

posix_fpathconf

(PHP 8 >= 8.3.0)

posix_fpathconf — Returns the value of a configurable limit

说明

function posix_fpathconf(resource|int $file_descriptor, int $name): int|false

Returns the value of a configurable limit from name for file_descriptor.

参数

file_descriptor

The file descriptor, which is expected to be either a file resource or an int. An int will be assumed to be a file descriptor that can be passed directly to the underlying system call.

name

The name of the configurable limit, one of the following. POSIX_PC_LINK_MAX, POSIX_PC_MAX_CANON, POSIX_PC_MAX_INPUT, POSIX_PC_NAME_MAX, POSIX_PC_PATH_MAX, POSIX_PC_PIPE_BUF, POSIX_PC_CHOWN_RESTRICTED, POSIX_PC_NO_TRUNC, POSIX_PC_ALLOC_SIZE_MIN, POSIX_PC_SYMLINK_MAX.

返回值

Returns the configurable limit or false.

错误/异常

Throws a ValueError when resource is invalid.

更新日志

版本 说明
8.5.0 Now sets last_error to EBADF and raises an E_WARNING when an invalid file descriptor is encountered.

示例

示例 #1 posix_fpathconf() example

This example will get the max path name's length in bytes for the current dir.

<?php
$fd = fopen(__DIR__, "r");
echo posix_fpathconf($fd, POSIX_PC_PATH_MAX);
?>

以上示例会输出:

4096

参见

来源:PHP Documentation Group · 作者与贡献记录 · CC BY 3.0。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
PHP Documentation Group
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。