小白教程
所有教程
关于
Search
172.71.255.12
172.71.255.12
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Func xml get current line number”的源代码
本页内容
上一节:
Func_xml_get_current_column_number
下一节:
Func_xml_get_error_code
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:xml_get_current_line_number()}}[[Category:PHP XML 参考手册|6]] = PHP xml_get_current_line_number() 函数 = [[:Category:PHP XML 参考手册]] == 定义和用法 == xml_get_current_line_number() 函数获取 XML 解析器的当前行号。 如果成功,该函数则返回当前行号。如果失败,则返回 FALSE。 == 语法 == <pre> xml_get_current_line_number(parser) </pre> {| class="table table-striped table-hover" ! 参数 ! 描述 |- | parser | 必需。规定要使用的 XML 解析器。 |} <sample title="" desc="" lang="php" hererun="1"> <?php //invalid xml file $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); ?> </sample> 上面代码的输出如下所示: <pre> ERROR: Mismatched tag Line: 5 Column: 41 </pre> [[:Category:PHP XML 参考手册]]
返回至“
Func xml get current line number
”。
上一节:
Func_xml_get_current_column_number
下一节:
Func_xml_get_error_code