|
|
|
@ -65,9 +65,11 @@ class MY_Output extends CI_Output {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//解析html,生成不同版本的静态文件
|
|
|
|
|
//替换图片地址,用CDN分发
|
|
|
|
|
|
|
|
|
|
$html_object = str_get_html($output);
|
|
|
|
|
if (!empty($html_object)) {
|
|
|
|
|
|
|
|
|
|
//替换图片地址,用CDN分发
|
|
|
|
|
foreach ($html_object->find('img') as $image) {
|
|
|
|
|
if (strpos($image->src, '/pic/') !== false) {
|
|
|
|
|
$image->src = 'https://data.asiahighlights.com' . $image->src;
|
|
|
|
@ -75,11 +77,16 @@ class MY_Output extends CI_Output {
|
|
|
|
|
$image->src = 'https://data.asiahighlights.com' . $image->src;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//保存PC端代码
|
|
|
|
|
$output = $html_object->save();
|
|
|
|
|
|
|
|
|
|
//生成移动版本
|
|
|
|
|
foreach ($html_object->find('.hidden-xs') as $hidden_item) {
|
|
|
|
|
$hidden_item->outertext = '';
|
|
|
|
|
}
|
|
|
|
|
$html_object->save($cache_path . '.mobile.htm');
|
|
|
|
|
}
|
|
|
|
|
//删除多余空格和换行符
|
|
|
|
|
$output = str_replace(array(" ", "\t", "\n", "\r"), " ", $output);
|
|
|
|
|
$output = str_replace(" ", " ", $output);
|
|
|
|
|
|
|
|
|
|
//////
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|