解决换行被替换问题

生成手机端静态页面
master
ycc 9 years ago
parent 0d76ae8e24
commit c89234dae0

@ -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);
//////

@ -1141,7 +1141,7 @@ class simple_html_dom
$this->original_size = $this->size;
//before we save the string as the doc... strip out the \r \n's if we are told to.
if ($stripRN) {
if ($stripRN && 1==2) {
$str = str_replace("\r", " ", $str);
$str = str_replace("\n", " ", $str);

Loading…
Cancel
Save