Dom\HTMLDocument::createFromFile

(PHP 8 >= 8.4.0)

Dom\HTMLDocument::createFromFileAnaliza un documento HTML a partir de un fichero

Descripción

public static Dom\HTMLDocument::createFromFile(string $path, int $options = 0, ?string $overrideEncoding = null): Dom\HTMLDocument

Analiza un documento HTML a partir de un fichero, según la norma vigente.

Parámetros

path
La ruta de acceso del fichero a analizar.
options

Bitwise OR of the libxml option constants.

It is also possible to pass Dom\HTML_NO_DEFAULT_NS to disable the use of the HTML namespace and the template element. This should only be used if the implications are properly understood.
overrideEncoding
The encoding that the document was created in. If not provided, it will attempt to determine the encoding that is most likely used.

Valores devueltos

El documento analizado en forma de una instancia de Dom\HTMLDocument.

Errores/Excepciones

  • Genera una ValueError si path contiene bytes nulos o contiene "%00".
  • Throws a ValueError if options contains an invalid option.
  • Throws a ValueError if overrideEncoding is an unknown encoding.
  • Genera una ValueError si el fichero no ha podido ser abierto.

Notas

Nota: Whitespace in the html and head tags is not considered significant and may lose formatting.

Ver también

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top