参数 | 描述 |
---|---|
errorcode | 必需。规定要使用的错误代码。该错误码是 xml_get_error_code() 函数的返回值。 |
返回与 errorcode 描述的错误代码参数对应的文本描述字符串,若没有与之对应的描述,则返回 false。
<?php
//无效的 xml 文件
$xmlfile = test.xml;
$xmlparser = xml_parser_create();
// open a file and read data
$fp = fopen($xmlfile, r);
while ($xmldata = fread($fp, 4096))
{
// parse the data chunk
if (!xml_parse($xmlparser,$xmldata,feof($fp)))
{
die( print "ERROR: "
. xml_error_string(xml_get_error_code($xmlparser))
. "<br />"
. "Line: "
. xml_get_current_line_number($xmlparser)
. "<br />"
. "Column: "
. xml_get_current_column_number($xmlparser)
. "<br />");
}
}
xml_parser_free($xmlparser);
?>
输出:
ERROR: Mismatched tag Line: 8 Column: 51
制作:
http://www.7di.net 生活网搜集整理 参考: http://www.w3school.com.cn/php/func_xml_error_string.asp |