Commit 914315ac authored by hj's avatar hj

更新提交0

parent d4888887
...@@ -29,19 +29,22 @@ class ChemicalsMsdsService ...@@ -29,19 +29,22 @@ class ChemicalsMsdsService
$platformParams = json_decode($comInfo['platform_params'], true); $platformParams = json_decode($comInfo['platform_params'], true);
$msds_html = preg_replace('/<dt>企业名称:<\/dt>[\s\S]*?<dd>[\s\S]*?<\/dd>/i', '<dt>企业名称:</dt> <dd>'.$platformParams['company_name'].'</dd>', $msds_html); $msds_html = preg_replace('/<dt>企业名称:<\/dt>[\s\S]*?<dd>[\s\S]*?<\/dd>/i', '<dt>企业名称:</dt> <dd>'.$platformParams['company_name'].'</dd>', $msds_html);
$msds_html = preg_replace('/<dt>企业地址:<\/dt>[\s\S]*?<dd>[\s\S]*?<\/dd>/i', '<dt>企业地址:</dt> <dd>'.$platformParams['company_address'].'</dd>', $msds_html); $msds_html = preg_replace('/<dt>企业地址:<\/dt>[\s\S]*?<dd>[\s\S]*?<\/dd>/i', '<dt>企业地址:</dt> <dd>'.$platformParams['company_address'].'</dd>', $msds_html);
$msds_html = preg_replace('/<dt>传真:<\/dt>[\s\S]*?<dd>[\s\S]*?<\/dd>/i', '<dt>传真:</dt> <dd>'.$platformParams['company_fax'].'<\/dd>', $msds_html); $msds_html = preg_replace('/<dt>传真:<\/dt>[\s\S]*?<dd>[\s\S]*?<\/dd>/i', '<dt>传真:</dt> <dd>'.$platformParams['company_fax'].'</dd>', $msds_html);
$msds_html = preg_replace('/<dt>联系电话:<\/dt>[\s\S]*?<dd>[\s\S]*?<\/dd>/i', '<dt>联系电话:</dt> <dd>'.$platformParams['company_phone'].'</dd>', $msds_html); $msds_html = preg_replace('/<dt>联系电话:<\/dt>[\s\S]*?<dd>[\s\S]*?<\/dd>/i', '<dt>联系电话:</dt> <dd>'.$platformParams['company_phone'].'</dd>', $msds_html);
} }
preg_match('/<body>[\s]*?<style>(?<bodyStyle>[\s\S]*?)<\/style>/i',$msds_html, $bodyStyle); preg_match('/<body>[\s]*?<style>(?<bodyStyle>[\s\S]*?)<\/style>/i',$msds_html, $bodyStyle);
$msds_html = preg_replace('/<body>[\s]*?<style>(?<bodyStyle>[\s\S]*?)<\/style>/i', '11123', $msds_html); $msds_html = preg_replace('/<body>[\s]*?<style>(?<bodyStyle>[\s\S]*?)<\/style>/i', '@body@', $msds_html);
$bodyStyle['bodyStyle'] = "<style>body{ font-family: 'msyh'; font-size: 0.8rem; font-weight: bold; display: block;}.container { padding-right: 5px;padding-left: 5px;margin-right: auto;margin-left: auto;width: 98%;} " . $bodyStyle['bodyStyle'] = "<style>body{ font-family: 'msyh'; font-size: 0.8rem; font-weight: bold; display: block;}.container { padding-right: 5px;padding-left: 5px;margin-right: auto;margin-left: auto;width: 98%;} " .
$bodyStyle['bodyStyle']."</style><body><div class='container'>"; $bodyStyle['bodyStyle']."</style><body><div class='container'>";
// 格式化处理
$msds_html = preg_replace('/\.sds-cn[\s]*?\{[\s]*?line-height: 1.5;[\s]*?\}/i', '.sds-cn{line-height: 2.5;}', $msds_html); $msds_html = preg_replace('/\.sds-cn[\s]*?\{[\s]*?line-height: 1.5;[\s]*?\}/i', '.sds-cn{line-height: 2.5;}', $msds_html);
$msds_html = preg_replace('/\.sds-cn[\s]*?dd.clearfix[\s]*?\{ margin-left: 20px;\[\s]*?\}/i', '.sds-cn dd.clearfix { margin-left: 20px; table-layout: fixed }', $msds_html); $msds_html = preg_replace('/\.sds-cn[\s]*?dd.clearfix[\s]*?\{ margin-left: 20px;\[\s]*?\}/i', '.sds-cn dd.clearfix { margin-left: 20px; table-layout: fixed }', $msds_html);
$msds_html = preg_replace('/\.sds-cn[\s]*?\.list-line[\s]*?li:before[\s]*?\{ content: " —— " \}/i', '.sds-cn .list-line li:before { content: " -- " }', $msds_html);
//$msds_html = preg_replace('/11123/', $bodyStyle['bodyStyle'], $msds_html); //$msds_html = preg_replace('/11123/', $bodyStyle['bodyStyle'], $msds_html);
$msds_html = preg_replace('/<\/body>/', '</div></body>', 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);
......
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