【问题标题】:extract multiple sentences from page using preg_match_all php使用 preg_match_all php 从页面中提取多个句子
【发布时间】:2016-11-25 16:39:13
【问题描述】:

所以我正在为 SudJMS(苏丹医学科学杂志)开发新网站 托管在 url (http://sudjms.net/med) 旧网站在 url 上仍然在线(没有 /med ) 我遇到的问题是旧网站页面是静态的(只有 HTML),所以我无法将文章从旧网站移动到新网站并将它们插入数据库(超过 420 篇文章)

所以我想使用 preg_match 从旧网站中提取我想要的数据

例如这个页面 http://sudjms.net/issues/11-2/html/2)Towards%20a%20Digitized%20and%20Integrated%20Health%20Information%20System%20in%20Sudan%20Assessment%20of%20Readiness%20at%20State%20Level.htm

在我提取页面内容后,我通过以下代码对 html 内容进行了一些干净的操作

$return = preg_replace(array('/\s{2,}/', '/[\t\n]/'), ' ', $return);
$return = strip_tags($return, "<b>");

我想通过正则表达式提取数据并将其插入到这样的数组中

$article = array("ABSTRACT" => array(
    "Background" => CONTENT,
    "Materials_and_Methods" => CONTENT,
    "Results" => CONTENT,
    "Conclusion" => CONTENT,
    "Keywords" => CONTENT), "ARTICLE" => array(
    "MATERIALS_AND_METHODS" => CONTENT,
    "RESULTS" => CONTENT,
    "DISCUSSION" => CONTENT,
    "CONCLUSION" => CONTENT,
    "REFERENCES" => CONTENT))

我的 preg_match 很弱,有什么帮助吗?

【问题讨论】:

标签: php regex preg-match preg-match-all


【解决方案1】:

我建议分三部分解决。

  1. 清除 HTML,使其格式正确,并可制成 SimpleXML 元素。
  2. 将“抽象”段落与 XPath 匹配。
  3. 我尝试将“内容”段落也与 XPath 匹配,但它不起作用,所以我从末尾循环标题,将内容存储到末尾,并删除了这一部分。 (这部分可以改进。)

尤其是对 HTML 的清理可能需要扩展。

$article = file_get_contents('http://sudjms.net/issues/11-2/html/2)Towards%20a%20Digitized%20and%20Integrated%20Health%20Information%20System%20in%20Sudan%20Assessment%20of%20Readiness%20at%20State%20Level.htm');
$article = utf8_encode($article);

// clean the HTML so it is well-formed
$replacements = array(
    "(<(?:meta|param|embed|br|img)\b[^<>]*)((?<!/)>)" => "$1/$2",  # close self closing elements
    '<p align="(center|left)">' => '',  # remove these p elements since they are missing a closing tag
    "&nbsp;" => "&#xa0;",  # make unicode entity
    "</span></div>" => "</span></p></div>",  # close p
    "(<html|body) [^>]+>" => "$1>",
    "<head>[\s\S]+?</head>" => "",
    "((?:class|clear|width|height|v?align|lang|style|cellspacing|border|colspan|cellpadding)=)([^\"'][^<>\s]*)" => "$1\"$2\"",
    "<o:p>(&#xa0;)?\s*</o:p>" => "",
    "<o:p><span style='text-decoration:none'>&#xa0;</span></o:p>" => "",
    "<!--\[if[\s\S]+?endif\]-->" => "",
    "<!\[if [\s\S]+?endif\]>" => "",
    "<!\[endif\]-->|<!\[endif\]>" => "",
    "v:shapes=" => "shapes=",
    "Key words" => "Keywords",
);
foreach ($replacements as $search => $replace) {
    $article = preg_replace("~$search~", $replace, $article);
}
$article = preg_replace("@\n|\s\s+@", " ", $article);  # normalize spaces
$article_as_xml = simplexml_load_string($article);

// abstract paragraphs
$abstract_paragraphs = array(
    "background" => "Background",
    "materials_and_methods" => "Materials and Methods",
    "results" => "Results",
    "conclusion" => "Conclusion",
    "keywords" => "Keywords",
);
// find paragraphs by XPath and store them
foreach ($abstract_paragraphs as $name => $xpath_search) {
    $content = "";
    $html = $article_as_xml->xpath('//*[name()="p" and contains(.//*[name()="span"], "'.$xpath_search.'")]');
    $content = $html[0]->span;
    $content = $content->asXML();

    $result["ABSTRACT"][$name] = trim($content);
}

$content_paragraphs = array(
    "Keywords:" => "MATERIALS AND METHODS:",  # first is the 'Abstract' paragraph
    "MATERIALS AND METHODS:" => "RESULTS:",
    "RESULTS:" => "DISCUSSION:",
    "DISCUSSION:" => "CONCLUSION:",
    "CONCLUSION:" => "REFERENCES:",
    "REFERENCES:" => "____________________",
    "____________________" => "",
);

// get main div as text
$html = $article_as_xml->xpath("//*[@class='Section1']");
$main_div = $html[0]->div->div->asXML(); 

$content_paragraphs = array_reverse($content_paragraphs);  # reverse to loop from the end

foreach ($content_paragraphs as $start => $end) {
    preg_match("~$start\s*</span>(?:</b>)?(?:</p>)?([\s\S]+)~", $main_div, $matches);
    $section = $matches[1];

    $main_div = str_replace($section, "", $main_div);  # delete a matched section 

    // delete the following heading from the end
    $section = preg_replace("~<p[^>]*>\s*<b[^>]*>\s*<span[^>]*>\s*$end\s*</span>\s*</b>\s*</p>~", "", $section);

    // add abstract paragraph to the "ABSTRACT" array
    if (strstr($start, "Keywords")) {
        $result["ABSTRACT"]["Abstract"] = $section;
    }
    // add anything else to the "CONTENT" array
    else {
        $start = (strstr($start, '________')) ? "FOOTNOTES" : $start; # name the '___' section "Footnotes"
        $result["CONTENT"][$start] = $section;
    }
}

$result["CONTENT"] = array_reverse($result["CONTENT"]);  # undo reverse

结果将是(我已经删除了一些 IMO 不必要的 style 标签,否则这篇文章会超出字符数限制):

array(2) {
  ["ABSTRACT"]=>
  array(6) {
    ["background"]=>
    string(763) "<span > A strong health information system able to generate timely and accurate information is essential to ensure effective and efficient performance. Sudans health information system is still paper-based and characterized by fragmentation and verticality. Efforts to overcome this have led to development of an integrated system to digitize the health information. For this to succeed the 18 states in Sudan need to be evaluated and assessed to identify the gaps in capacity and readiness for such important change. The aim of this paper is to assess the capacity and readiness of the health information system in Sudan at state level for the digitization of the health information system.</span>"
    ["materials_and_methods"]=>
    string(459) "<span > This is a cross sectional institutional based study conducted in 2014 targeting the health information units in the 18 states ministries of health in Sudan. Quantitative data was collected using a pre-tested checklist and analyzed using SPSS version 20. Qualitative data was collected through semi-structured interviews with state managers and analyzed using the evaluation matrix.</span>"
    ["results"]=>
    string(534) "<span > All states ministries of health had health information units but this was believed inadequate in 27.8% and 72.2% had units at locality level. Data analysis units were not present in one third of the states. Basic statistical training was done in 15 states. Internet services was available in 14 states but was scarce at locality level (16.7%). Annual reports though produced by 17 states, one third admit not reporting to higher levels in a regular manner.</span>"
    ["conclusion"]=>
    string(300) "<span > There is a need to strengthen the health information system at state level. Challenges of ICT infrastructure, capacity building and coordination need to be addressed. This needs collaborative work and political commitment.</span>"
    ["keywords"]=>
    string(126) "<span > Health Information System, states, digitization.</span>"
    ["Abstract"]=>
    string(3798) " </b> <span > Health Information System, states, digitization.</span></p></div> <span > <br clear="all" style="page-break-before: always"/>  </span><p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <div style="mso-element: dropcap-dropped; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly; mso-element-linespan: 3">  </div> <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph"> <span > A health  information  system (HIS), which is  defined  as :  a  mechanism  for  collection, processing,  analysis  and  transmission  of  information  required  for  organizing and  operating  health  services,  research and  training <sup> 1</sup>, It is through information and evidence that important decision making that is essential to improve health system performance, accountability and health outcomes can be made<sup>2</sup>.</span></p> <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph"> <span > The Sudan HIS is one of the first information systems established in the region. It has a bottom-up approach where data thatis collected from the facilities, is compiled at the locality/district level. This is sent to State Ministry of Health (SMOH) and further consolidated to be sent to Federal Ministry of Health (FMOH) where all filled forms from all the states are put together each year to give rise to the Annual Statistical Report. This important process is almost entirely done manually. Efforts are now being made to digitize the health information system to increase efficiency and timely reporting. For this to be successful, the health information system needs to be assessed for its readiness for such important change.</span></p> <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph"> <span > The last national HIS Assessment was carried out in 2007 under the Health Metric Network (HMN) project and this found the existing system to be deficient to support management functions and informing the planning and policy making in a meaningful way <sup> 2</sup>.</span></p> <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph"> <span > Sudan like many developing countries is facing the double burden of both communicable and non-communicable diseases and with the high turnover of qualified staff; the country needs a stronger and more efficient health system. This cannot be done without a  strong and well-functioning  health  information  system  ( HIS ) that  ensures  the  production, analysis, dissemination  and  use  of  reliable  and  timely  information  on  health  determinants, health  system  performance  and  health  status. All  of  these  components contribute  to  better  health  policy  and  planning, efficient health  resources  allocation, and improved health service delivery. This paper is concerned with assessment of the health information system readiness for digitization at the state level.</span></p>    "
  }
  ["CONTENT"]=>
  array(6) {
    ["MATERIALS AND METHODS:"]=>
    string(4798) " <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph"> <i> <span > Study design:</span></i><span > This is a cross  sectional institutional based study.</span></p> <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph"> <span > Study settings: 18 Information units in the 18 states ministries of health in the Republic of Sudan    </span></p> <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph"> <i> <span > Study population: </span></i> <span > The study population are Mangers of units in the 18 states, Directorate of planning in the 18 states, Statisticians and other qualifications and training received, the infrastructures at units</span></p> <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph"> <i> <span > Sampling size and Sampling Technique: </span></i> <span > Total coverage (18 information units from 18 states)</span></p> <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph"> <i> <span > Data collection method: </span></i> <span > List of variables:  Availability of planning, human resource, level of qualification and training, status of infrastructure: Availability of basic ICT equipment, and availability of financial resource     </span> </p> <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph"> <i> <span > Data collections tools: </span></i> <span > Close and open structure questionnaires for statisticians, Standard checklist modified to include the equipment and infrastructure, In depth interview  with Health Information managers and Directorate of Planning in the 18 states. The tools of the study (questionnaires and checklists) were pretested and the questionnaire and checklist were reviewed and revised, necessary correction and omissions were performed.</span></p> <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph"> <i> <span > Training of data collectors: </span> </i> <span > Data through interviews were collected by the researcher. Data through questionnaire and check list were collected by 6-7 statisticians. Data collectors were trained for two days on how to fill the tools properly and how to make sure that every question and its option is clear and understood. They were also trained to introduce themselves friendly and to explain the study objective. </span> </p> <p class="MsoListParagraphCxSpFirst" style="text-align: justify; text-justify: inter-ideograph; margin-left: 0in"> <i> <span > Ethical considerations: </span></i> <span > Ethical clearance was obtained from the Institutional Review Board at Elneelain University and the National Research Ethics Committee (RECS) at the Federal Ministry of Health. Permissions were obtained from the concerned departments and an informed consent was obtained from each study participant prior to the interview. </span> </p> <p class="MsoListParagraphCxSpMiddle" style="text-align: justify; text-justify: inter-ideograph; margin-left: 0in"> <i> <span > Data analysis: </span></i> <span > Quantitative data was analyzed by computer using SPSS version 20. Qualitative data was analyzed using the evaluation toolbox. (Semi- structure  interview- data collection and analysis template).</span></p> <p class="MsoListParagraphCxSpMiddle" style="text-align: justify; text-justify: inter-ideograph; margin-left: 0in"> <b> <span style="font-family: 'Times New Roman',serif">  </span></b></p>   "
    ["RESULTS:"]=>
    string(7117) " <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph"> <span > All 18 states ministries of health had health information units/departments (100%). Furnished offices available for health information units in the states ministries of health were found to be adequate in 72.2% of the states. Information units at level of the locality were present in 72.2 % of the states. All states had an information unit with workforce about five or more cadre working. 66.7 % had workers between 5 and10 and 33.3 % had cadre more than 10. All information units had statisticians (100%), followed by information technicians 66.7%, demographers 33.3% while the least was the presence of public health personnel 11.1 %. </span></p> <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph"> <a href="../images/2)Towa6.jpg"> <img border="2" src="../images/2)Towa5.jpg" xthumbnail-orig-image="../images/2)Towa6.jpg"/></a></p> <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph"> <span > Fig. (1): Status of health information system working environment in the 18 states in 2014</span></p> <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph"> <b> <span style="font-size: 5.0pt; font-family: 'Times New Roman',serif">  </span></b></p> <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph"> <span > Table (1): Health information system work force training courses in the 18 states in 2014</span></p> <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph"> <a href="../images/2)Towa8.gif"> <img border="2" src="../images/2)Towa7.gif" xthumbnail-orig-image="../images/2)Towa8.gif"/></a><span style="font-size: 4.0pt; font-family: 'Times New Roman',serif"> </span></p> <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph"> <span > Regarding communication infrastructure and internet availability, 15(83.3 %) states had printers in their units while telephones were only present in 5 states information units and only, 3(16.7%) states possessed fax facilities. Internet service was available in 14(77.8 %) states. Only three states localities and 4 (22.2) state hospitals had internet facilities. Electric supply stability was found adequate in just above half (55.6 %) of the states.</span></p> <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph"> <b> <span style="font-size: 3.0pt; font-family: 'Times New Roman',serif">  </span></b></p> <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph"> <span > Table (2): Availability of information communication infrastructure in the 18 states in 2014</span></p> <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph"> <a href="../images/2)Towa10.gif"> <img border="2" src="../images/2)Towa9.gif" xthumbnail-orig-image="../images/2)Towa10.gif"/></a><span style="font-size: 4.0pt; font-family: 'Times New Roman',serif"> </span></p> <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph"> <span > Availability of registers was adequate in 61.1 % as well as availability of reports. Adequate availability of birth notification was found in 12 states whereas death notifications availability was good in one state and adequate in only eight states. Mortality statistics report was available at 83.3%. Sources mainly were from public health facilities followed by private health facilities, community level and civil registry. Reported statistics from Central Bureau of Statistics (CBS) and private sector was available from 14(77.8%) and 3(16.7%) respectively. Cooperation with other departments within the state ministry of health was found good in 94.4% and in 66.7% there was coordination with state civil registration.</span></p> <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph"> <span > Periodical supervision in the 18 states was only present in 7(38.9%) states. All locality information units received supervisory visits followed by hospitals in six of the states, five Healthcare centers in five of the states, only PHC units in three states and one dispensary and one dressing station.</span></p> <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph"> <span > Computers were used for data analysis in 88.9%. A Statistical program installed was available in 18 (94.4%) computers, but 5.6% dont have it. Data analysis units were not present in 33.3%. Guidelines for data quality assurance were present in 61.1% and feedback mechanisms were available in 50%.</span></p> <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph"> <span > Regarding generation of reports, annual and quarterly reports were produced by 17 states while monthly reports were available in 13 states. Data is storage is paper based in 16(88.9%) states while electronic data storage were found in 14(77.8%) states. One third admitted they do not report regularly to higher levels in time.</span></p> <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph"> <span > HIS managers in 15 states agreed to participate in the interviews giving a response rate of 83.3%. A clear vision for the HIS at the state level was present in 12(80%) states. Presence of a health information annual plan that is endorsed is available in 14(93.3%) states. An endorsed coordination mechanism was only present in 9(60%) states. Regular supervision to locality health information units was not present in 6(40%) states. Response benefiting from indicators data in decision making was in 13(86.7%). All interviewed state managers were in favor of the integration for overcoming the fragmentation in HIS and saw the digitization of the integrated system and implementation of DHIS2 will be crucial to improve the performance and efficacy of the HIS in Sudan. Challenges stated included the need to establishing and strengthening HIS at community level. Some states suffer from shortage of statistical technicians. There is a need for political support at both state and locality levels.</span></p>    "
    ["DISCUSSION:"]=>
    string(4085) " <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph"> <span > At both federal and state levels, computers are available. As for ICT infrastructure, all state units have printers except three states, three state units have fax and five state units use telephones.</span></p> <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph"> <span > Internet service is available in 14(77.8%) states but 8(44.4%) states yet, they suffer of power instability. The lack of basic infrastructure as electricity may remain a serious constraint in low-income countries for some time. It is often difficult for governments to put scarce resources into paper, pencils, registers, and computer equipment<sup>3</sup>. The availability of computers and other ICT equipment at locality and health facility levels are scare, a challenge that in other developing countries.</span></p> <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph"> <span > While most health units in industrialized countries have access to computer equipment, in many developing countries computers are still not available at the district level. Yet rapidly developing Computer technology will make health information systems increasingly effective and powerful management tools for the health services. Computer equipment is becoming more affordable<sup>4</sup>.</span></p> <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph"> <span > Telephones and faxes are rarely used in state information units, while it has been shown that the use of telephones have been successfully used in many places to overcome barriers caused by internet unavailability<sup>5</sup>.</span></p> <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph"> <span > The study finding show that 14 of the states get CBS statistics, 12 states coordinate with civil registration and coordination between health information units and the other departments in 17(94.4%) states. This performance improves the efficacy of the system. This is proved by the fact that most of the states have mortality statistics reports, and all states get mortality statistics from private health facilities, community and civil registry. Also, all states get birth statistics from public health facilities and eight states get them from private facilities, community level and civil registry.</span></p> <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph"> <span > Information on births and deaths as well as causes of death is used as health indicators. If those countries are to make greater use of them in monitoring the impact of health programs and policies, urgent measures are required to improve the functioning of the systems and quality of the statistics they provide<sup>7</sup>.</span></p> <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph"> <span > In this study we find that 13(72.2%) state information units produce monthly reports; 17(94.4%) produced quarterly then annual reports but only three (16.7%) states get statistics report from private health sectors. This necessitates development of Health Information Strategies for strengthening leadership, coordination and organizational management structure.</span></p>    "
    ["CONCLUSION:"]=>
    string(858) " <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph"> <span > The Health information system in Sudan, though one of the oldest systems, is still considered weak and fragmented. Integration and digitization of the system is an important step towards strengthening the HIS. Challenges in ICT infrastructure, coordination mechanisms and capacity building of health information units especially in the states and to the level of the locality need to be addressed to achieve goals of timely and accurate reporting. All this need collaborative efforts at all levels and strong political commitment at both federal and state level for its success.</span></p>  <p><b><span > <br clear="all"/>  </span></b></p> "
    ["REFERENCES:"]=>
    string(5431) " <p > <span > 1.<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7.0pt; font-family: Times New Roman">       </span></span> <span > Park JE. Parks textbook of Preventive and Social Medicine. BanarasidasBhanot. Demography and family planning.2009 .20th p. 742 .</span></p> <p class="Pa0" style="text-align: justify; text-justify: inter-ideograph; text-indent: -.25in; line-height: normal; margin-left: .25in"> <span style="font-size: 10.0pt; font-family: 'Times New Roman',serif; font-weight: normal"> 2.<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7.0pt; font-family: Times New Roman">       </span>GahiniCH.. Improving the structure and performance of National Health Information system. Operational approach  and  strategic  recommendations,   Pan  American  Health  Organistion regional  office, World Health Organization,  Santiago  de Chile,  2009  - p. 17 </span> </p> <p > <span > 3.<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7.0pt; font-family: Times New Roman">       </span>Nimeiri M.K, Moustafa M.S , Makki Met al </span> <span > Sudan Health Information  System Review and Assessment Report .Health Metric Network May 2007</span></p> <p > <span > 4.<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7.0pt; font-family: Times New Roman">       </span></span> <span > Lippeveld T. Routine health information systems: the glue of a unified health system. InKeynote address at the Workshop on Issues and Innovation in Routine Health Information in Developing Countries, Potomac, March 2001  p. 14-16</span></p> <p > <span > 5.<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7.0pt; font-family: Times New Roman">       </span></span> <span > KinfuY, Sudan Health System Performance Assessment: Final Report, Federal Ministry of Health, 2012</span></p> <p > <span > 6.<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7.0pt; font-family: Times New Roman">       </span></span> <span > Kamara C,</span><span >Magbity E, Conteh D et al</span><span >,</span><span >Sierra Leone Health Information Systems Strategic Plan 2007  2016,  2006 p. 11</span></p> <p > <span > 7.<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7.0pt; font-family: Times New Roman">       </span></span> <span > On ML, Bennett V, Whittaker M. Health information systemsKnowledge Hub, Working paper series number 8, Queensland University, November 2009.</span></p>        <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph"> <span style="font-size: 8.0pt; font-family: 'Times New Roman',serif"> ________________________________________________</span></p>"
    ["FOOTNOTES"]=>
    string(1118) " <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph; margin-top: 6.0pt"> <span > 1.Health Information Research &amp; Evidence, Federal Ministry Of Health (FMOH), Sudan</span></p> <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph"> <span > 2.Professor of Preventive Medicine &amp;Epidemiology, Faculty of Medicine, Elneelain University, Sudan</span></p> <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph"> <span > *Correspondence to<b>: </b> <span style="background: white"> amal.m.o.abbas@gmail.com</span></span></p>  <p class="MsoNormal" style="margin-left: 0in; margin-right: 0in; margin-top: 6.0pt; margin-bottom: 12.0pt"> <span >  </span></p></div>"
  }
}

【讨论】:

  • 我在这个链接上试过你的代码但没有用:(sudjms.net/issues/5-3/html/…
  • 我得到错误 simplexml_load_string(): Entity: line 6: parser error : AttValue: "或 ' 预期在 E:\xampp\htdocs\sudjms.php 在第 34 行的其他链接
  • 我添加了一些搜索和替换模式来清理 HTML。但是,如果所有文章的 HTML 看起来像这样,你最好下载所有文章并规范化 HTML 和措辞(一次是“结论”,另一次是“结论:”等)。
  • 很抱歉问了太多简单的问题 :D 但你能告诉我是什么导致了链接sudjms.net/issues/5-3/html/… 上的错误,以便我可以解决并了解导致错误的原因吗?哪些标签?或者任何可以帮助我学习的东西:D 不要给我鱼,而是教我钓鱼:D
  • 在这种情况下有 o:p 元素。 o 命名空间需要声明,但由于没有任何内容,因此也可以将其删除。有几个 HTML 验证器可用于检查 HTML(通过 URL 或直接输入),例如 validator.w3.orgfreeformatter.com/html-validator.html。如果你不知道这些消息的含义,你可以用谷歌搜索它们。找到解释应该没有问题。
猜你喜欢
  • 1970-01-01
  • 2011-05-23
  • 1970-01-01
  • 1970-01-01
  • 2017-04-01
  • 1970-01-01
  • 1970-01-01
  • 2019-10-24
  • 1970-01-01
相关资源
最近更新 更多