• 首页
  • vue
  • TypeScript
  • JavaScript
  • scss
  • css3
  • html5
  • php
  • MySQL
  • redis
  • jQuery
  • 位置: php 中文手册 -> php 外部扩展库

    libxml库

    此扩展需要libxml >= 2.6.0。

    安装

    默认情况下,libxml扩展是启用的,尽管可以使用--disable-libxml禁用它。

    可选的--with-libxml-dir指令用于指定编译PHP的系统上libxml的位置,否则只扫描默认位置。配置过程按以下顺序检查libxml(特别是xml2-config):

    1. --with-libxml-dir([DIR]=/bin/xml2-config)指定的位置([DIR])
    2. /usr/local/bin/xml2-config
    3. /usr/bin/xml2-config

    如果configure在--with-libxml-dir指定的目录中找不到xml2-config,那么它将继续并检查默认位置。

    libXMLError类

    (PHP 5 >= 5.1.0, PHP 7)

    包含有关libxml引发的错误的各种信息。http://www.xmlsoft.org/html/libxml-xmlerror.html

    libXMLError
    {
    	/* 属性 */
    	public int $level ;
    	public int $code ;
    	public int $column ;
    	public string $message ;
    	public string $file ;
    	public int $line ;
    }
    

    属性

    • $level:the severity of the error (one of the following constants: LIBXML_ERR_WARNING, LIBXML_ERR_ERROR or LIBXML_ERR_FATAL)
    • $code:The error's code.
    • $column:The column where the error occurred.Note:This property isn't entirely implemented in libxml and therefore 0 is often returned.
    • $message:The error message, if any.
    • $file:The filename, or empty if the XML was loaded from a string.
    • $line:The line where the error occurred.