繁体   English   中英

如何解决Joomla网站上的html解析器错误?

[英]How to solve the html parser error on Joomla site?

大家好,我最近将网站迁移到了新服务器,现在每次转到首页时都会出现错误。

http://144.130.57.1​​97/MonashHealthNew/beta.monashhealth.org/en/

这是我遇到的错误,我对此一无所知:

解析器= xml_parser_create($ encoding); xml_set_object($ this-> parser,&$ this); xml_parser_set_option($ this-> parser,XML_OPTION_CASE_FOLDING,0); xml_parser_set_option($ this-> parser,XML_OPTION_SKIP_WHITE,1); xml_parser_set_option($ this-> parser,XML_OPTION_TARGET_ENCODING,'UTF-8'); xml_set_element_handler($ this-> parser,“ start_element”,“ stop_element”); xml_set_character_data_handler($ this-> parser,“ char_data”); }函数force_to_array(){for($ i = 0; $ i <func_num_args(); $ i ++){$ this-> force_to_array [] = func_get_arg($ i); }} / *解析XML数据,并将其存储在实例变量中; 如果无法解析数据,则返回false。 * /函数parse($ data){$ this-> tree = array(); 如果(!xml_parse($ this-> parser,$ data,1)){$ this-> error =“ xml解析错误:”。 xml_error_string(xml_get_error_code($ this-> parser))。 “在线”上。“。xml_get_current_line_number($ this-> parser); 返回false; }返回$ this-> tree [0] [“ content”]; }函数parse_file($ file){$ fp = @fopen($ file,“ r”); 如果(!$ fp){user_error(“无法打开文件:'$ file'”); 返回false; } while($ data = fread($ fp,4096)){if(!xml_parse($ this-> parser,$ data,feof($ fp))){user_error(“ xml parse error:”。xml_error_string(xml_get_error_code( $ this-> parser))。“在线”。xml_get_current_line_number($ this-> parser)); }} fclose($ fp); 返回$ this-> tree [0] [“ content”]; }函数encode_as_xml($ value){如果(is_array($ value)){reset($ value); $ out =''; while(list($ key,$ val)= each($ value)){if(is_array($ val)&& isset($ val [0])){reset($ val); while(list(,$ item)= each($ val)){$ out。=“” .xml_simple :: encode_as_xml($ item)。“”; }}其他{$ out。=“” .xml_simple :: encode_as_xml($ val)。“”; 返回$ out; } else {return htmlspecialchars($ value); }}函数start_element($ parser,$ name,$ attrs){array_unshift($ this-> tree,array(“ name” => $ name)); }函数stop_element($ parser,$ name){如果($ name!= $ this-> tree [0] [“ name”])die(“不正确的嵌套”); 如果(count($ this-> tree)> 1){$ elem = array_shift($ this-> tree); if(isset($ this-> tree [0] [“ content”] [$ elem [“ name”]]))){if(is_array($ this-> tree [0] [“ content”] [$ elem [ “ name”]])&& isset($ this-> tree [0] [“ content”] [$ elem [“ name”]] [0])){array_push($ this-> tree [0] [“ content “] [$ elem [” name“]],$ elem [” content“])); } else {$ this-> tree [0] [“ content”] [$ elem [“ name”]] = array($ this-> tree [0] [“ content”] [$ elem [“ name”]] ,$ elem [“ content”])); }} else {if(in_array($ elem [“ name”],$ this-> force_to_array)){$ this-> tree [0] [“ content”] [$ elem [“ name”]] = array($ elem [“ content”]); } else {if(!isset($ elem [“ content”]))$ elem [“ content”] =“”; $ this-> tree [0] [“ content”] [$ elem [“ name”]] = $ elem [“ content”]; }}}}函数char_data($ parser,$ data){#不要在非字符串数据中添加字符串,如果(!is_string($ this-> tree [0] [“ content”])&&!preg_match(“ / \\ S /“,$ data))返回; $ this-> tree [0] [“ content”]。= $ data; }}

但是,我网站的其他页面运行良好。 您可以通过访问此页面http://144.130.57.1​​97/MonashHealthNew/beta.monashhealth.org/en/contact-us来看看

谢谢您的任何帮助。 提前致谢。

我认为xml-simple.php是问题。 如果您查看源(在主页http://144.130.57.1​​97/MonashHealthNew/beta.monashhealth.org/en/上 ),则从以下内容开始:

<?

/ * xml-simple.php

您可以将其更改为(在xml-simple.php文件中)吗?

<?php

/ * xml-simple.php

我认为在配置(php.ini)中禁用了“ short_open_tag”

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM