Commit 863fd2b9 authored by hj's avatar hj

更新提交

parent 4dec46e5
......@@ -33,6 +33,12 @@ class ChemicalsMsdsService
$msds_html = preg_replace('/<dt>联系电话:<\/dt>[\s\S]*?<dd>[\s\S]*?<\/dd>/i', '<dt>联系电话:</dt> <dd>'.$platformParams['company_phone'].'</dd>', $msds_html);
}
/*if(preg_match('/<div[\s]*?class=[\\\'|\"]sds-cn-content[\\\'|\"]>(?<content>[\s\S]+?)<\/div><\/body>/i', $msds_html, $content)){
if($content['content']){
preg_match('/(?<title>[\s\S]*?)<dl><\/dl>/i')
}
}*/
$msds_html = preg_replace('/<html>/i', '<html lang="zh_CN no-js">', $msds_html);
$msds_html = preg_replace('/<meta[\s]*?charset=[\"]UTF\-8[\"]/i', '<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
......@@ -48,14 +54,15 @@ class ChemicalsMsdsService
$bodyStyle['bodyStyle']."</style><body><div class='container'>";
// 格式化处理
$bodyStyle['bodyStyle'] = preg_replace('/\.sds-cn[\s]*?\{[\s]*?line-height: 1.5;[\s]*?\}/i', '.sds-cn{line-height: 2.5;}', $bodyStyle['bodyStyle']);
$bodyStyle['bodyStyle'] = preg_replace('/\.sds-cn[\s]*?\{[\s]*?line-height: 1.5;[\s]*?\}/i', '.sds-cn{line-height: 2.5;word-break:break-all}', $bodyStyle['bodyStyle']);
$bodyStyle['bodyStyle'] = preg_replace('/\.sds-cn[\s]*?dd.clearfix[\s]*?\{ margin-left: 20px;[\s]*?\}/i', '.sds-cn dd.clearfix { width:80% }', $bodyStyle['bodyStyle']);
$bodyStyle['bodyStyle'] = preg_replace('/\.sds-cn[\s]*?\.list-line[\s]*?li:before[\s]*?\{ content: " —— " \}/i', '.sds-cn .list-line li:before { content: " -- " }', $bodyStyle['bodyStyle']);
//$msds_html = preg_replace('/11123/', $bodyStyle['bodyStyle'], $msds_html);
$msds_html = preg_replace('/<\/body>/', '</div></body>', preg_replace('/@body@/', $bodyStyle['bodyStyle'], $msds_html));
//file_put_contents('./test.html', $msds_html);
file_put_contents('./test.html', $msds_html);
//$msds_html = file_get_contents('./test.html');
$this->getPdfApp()->loadHTML($msds_html, 'utf-8');
//echo $htmlTemp;
......
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