打开app\site\lib\controller.php

/*
     * 提取widgets css
     * @var string $body
     * @access public
     * @return void
     */
    public function extract_widgets_css(&$body)
    {
        preg_match_all('/<\s*style.*?>(.*?)<\s*\/\s*style\s*>/is', $body, $matchs);
        if(isset($matchs[0][0]) && !empty($matchs[0][0])){
            foreach($matchs[0] AS $matchcontent){
                $body = str_replace($matchcontent, '', $body);
            }
            $this->append_widgets_css($matchs[1]);
        }
    }//End Function
//改为
/*
     * 提取widgets css
     * @var string $body
     * @access public
     * @return void
     */
    public function extract_widgets_css(&$body)
    {
        preg_match_all('/<\s*style.*?>(.*?)<\s*\/\s*style\s*>/is', $body, $matchs);
        if(isset($matchs[0][0]) && !empty($matchs[0][0])){
            foreach($matchs[0] AS $matchcontent){
               // $body = str_replace($matchcontent, '', $body);//清除原生style样式
            }
            $this->append_widgets_css($matchs[1]);
        }
    }//End Function

 

posted on 2017-12-28 10:14  limonyun  阅读(143)  评论(0编辑  收藏  举报