php8.5
Home/ Manual/ stream / streamwrapper/ streamWrapper::url_stat

streamWrapper::url_stat

PHP function Edit on GitHub ✎

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

Retrieve information about a file

Description

streamWrapper::url_stat(string $path, int $flags): array|false

This method is called in response to all stat() related functions, such as:

Parameters

path

The file path or URL to stat. Note that in the case of a URL, it must be a :// delimited URL. Other URL forms are not supported.

flags

Holds additional flags set by the streams API. It can hold one or more of the following values OR'd together.

FlagDescription
STREAM_URL_STAT_LINKFor resources with the ability to link to other resource (such as an HTTP Location: forward, or a filesystem symlink). This flag specified that only information about the link itself should be returned, not the resource pointed to by the link. This flag is set in response to calls to lstat(), is_link(), or filetype().
STREAM_URL_STAT_QUIETIf this flag is set, your wrapper should not raise any errors. If this flag is not set, you are responsible for reporting errors using the trigger_error() function during stating of the path.

Return Values

Should return an Array with the same elements as stat() does. Unknown or unavailable values should be set to a rational value (usually 0). Special attention should be paid to mode as documented under stat(). Should return false on failure.

Errors/Exceptions Warning

Notes Context

See Also

  • stat()
  • streamwrapper::stream_stat

Source: reference/stream/streamwrapper/url-stat.xml · from the official PHP manual (php/doc-en)