//********增加的内容*******// $content = $this->parseLinkAddHost($content); // href加上域名 //********增加的内容*******// return $content; } //********增加的内容*******// /** * href加上域名 */ function parseLinkAddHost($content){ $pattern = '/href="\/(.*)"/isU'; $http_type = is_https() ? 'https://' : 'http://'; $http_host = $http_type . $_SERVER['HTTP_HOST'].'/'; $content = preg_replace($pattern, 'href="'.$http_host.'$1"', $content); return $content; } //********增加的内容*******//