Commit 4047fb1c authored by hj's avatar hj

更新提交

parent e08e06a5
...@@ -79,7 +79,7 @@ class ChemicalsMsdsService ...@@ -79,7 +79,7 @@ class ChemicalsMsdsService
} }
$msds_html = str_replace($dl, $dlHtml, $msds_html); $msds_html = str_replace($dl, $dlHtml, $msds_html);
} }
if($key == 1 || $key == 3 || $key == 2 || $key == 4 || $key == 11 || $key == 7 || $key == 8 || $key == 10 || $key == 12){ if(in_array($key, [1,2,3,4,6,7,8,10,11,12])){
preg_match_all('/<dt>(?<cTitle>[\s\S]*?)<\/dt>[\s]*?<dd[\s\S]*?>(?<cContent>[\s\S]*?)<\/dd>/i', $dl, $ddContent); preg_match_all('/<dt>(?<cTitle>[\s\S]*?)<\/dt>[\s]*?<dd[\s\S]*?>(?<cContent>[\s\S]*?)<\/dd>/i', $dl, $ddContent);
if($ddContent){ if($ddContent){
$dlHtml = ''; $dlHtml = '';
...@@ -108,7 +108,24 @@ class ChemicalsMsdsService ...@@ -108,7 +108,24 @@ class ChemicalsMsdsService
} }
} }
} }
preg_match('/(?<title>第[\s]*?3[\s\S]+?)<table[\s]*?class=[\\\'|\"]table-text-center avoid-page-break-inside[\\\'|\"]>[\s\S]*?<\/table>/i', $content['content'], $tableContent); if(preg_match('/<h2[\s]*?style=[\\\'|\"]font-size: 1.3rem;font-weight: bold[\\\'|\"]>[\s]*?(?<cTitle>第9部分 理化特性)(?<content>[\s\S]*?)<\/h2>/i', $msds_html,$content)){
if($content['content']){
$msds_html = str_replace($content['cTitle'], $content['cTitle'].'</h2>', $msds_html);
$msds_html = str_replace($content['content'], '<h2 style="font-size: 1.3rem;font-weight: bold">'.$content['content'], $msds_html);
}
}
if(preg_match('/<h2[\s]*?style=[\\\'|\"]font-size: 1.3rem;font-weight: bold[\\\'|\"]>[\s]*?第15部分 法规信息(?<content>[\s\S]*?)<\/h2>/i', $msds_html,$content)){
if($content['content']){
$dlHtml = '';
preg_match('/<p>(?<cTitle>[\s\S]*?)<\/p>[\s]*?<u>(?<cContent>[\s\S]*?)<\/u>/i', $content['content'], $c);
$dlHtml .= '<div style="width:90%"><span style="margin: 0;"><b>'.$c['cTitle'].'</b></span>';
$dlHtml .= '<span style="font-weight: normal;"><p>'.$c['cContent'].'</p></span></div>';
$msds_html = str_replace($content['content'], '</h2>'.str_replace('</h2>', '',$content['content']), $msds_html);
$msds_html = str_replace($content['content'], $dlHtml, $msds_html);
}
}
/*preg_match('/(?<title>第[\s]*?3[\s\S]+?)<table[\s]*?class=[\\\'|\"]table-text-center avoid-page-break-inside[\\\'|\"]>[\s\S]*?<\/table>/i', $content['content'], $tableContent);
if($tableContent['title']){ if($tableContent['title']){
$msds_html = str_replace($tableContent['title'],'<h2 style="font-size: 1.3rem;font-weight: bold">'.$tableContent['title'].'</h2>', $msds_html); $msds_html = str_replace($tableContent['title'],'<h2 style="font-size: 1.3rem;font-weight: bold">'.$tableContent['title'].'</h2>', $msds_html);
} }
...@@ -116,7 +133,7 @@ class ChemicalsMsdsService ...@@ -116,7 +133,7 @@ class ChemicalsMsdsService
preg_match('/(?<title>第4[\s\S]*?)<dl>[\s\S]*?<\/dl>/i', $content['content'], $dlContent); preg_match('/(?<title>第4[\s\S]*?)<dl>[\s\S]*?<\/dl>/i', $content['content'], $dlContent);
if($dlContent['title']){ if($dlContent['title']){
$msds_html = str_replace($dlContent['title'],'<h2 style="font-size: 1.3rem;font-weight: bold">'.$dlContent['title'].'</h2>', $msds_html); $msds_html = str_replace($dlContent['title'],'<h2 style="font-size: 1.3rem;font-weight: bold">'.$dlContent['title'].'</h2>', $msds_html);
} }*/
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment