XMLReader::open

(PHP 5 >= 5.1.0, PHP 7, PHP 8)

XMLReader::openSet the URI containing the XML to parse

Опис

public static XMLReader::open(string $uri, ?string $encoding = null, int $flags = 0): XMLReader
public XMLReader::open(string $uri, ?string $encoding = null, int $flags = 0): bool

Set the URI containing the XML document to be parsed.

Параметри

uri

URI pointing to the document.

encoding

The document encoding or null.

flags

A bitmask of the LIBXML_* constants.

Значення, що повертаються

Повертає true у разі успіху або false в разі помилки. If called statically, returns an XMLReader або false в разі помилки.

Помилки/виключення

  • Passing an invalid encoding will throw a ValueError.
  • This method may be called statically, but prior to PHP 8.0.0, will issue an E_DEPRECATED error in this case.

Журнал змін

Версія Опис
8.4.0 Passing an invalid encoding will now throw a ValueError.
8.0.0 XMLReader::open() is now declared as static method, but can still be called on an XMLReader instance.

Прогляньте також