PHP xml_error_string() 函数
定义和用法
xml_error_string() 函数获取 XML 解析器的错误描述。
语法
xml_error_string(errorcode)
参数 | 描述 |
---|---|
errorcode | 必需。 |
వివరణ
తో సహా 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 />" . "వరుస: " . xml_get_current_line_number($xmlparser) . "<br />" . "కలన్: " . xml_get_current_column_number($xmlparser) . "<br />"); } } xml_parser_free($xmlparser); ?>
అవుట్పుట్:
ERROR: తప్పుగా టాగ్ వరుస: 8 కలన్: 51