您现在的位置是:首页>建站教程>二开功能
将PbootCMS的页面url改为绝对路径
  王青召个人博客 2023-01-06 二开功能 60737人已围观
 王青召个人博客 2023-01-06 二开功能 60737人已围观 
简介将PbootCMS的页面url改为绝对路径,app/home/controller/ParserController.php 添加红线中的代码。//解析全局后置公共标签publicfunctionparserAfter($content){...&
将PbootCMS的页面url改为绝对路径,app/home/controller/ParserController.php 添加红线中的代码。
// 解析全局后置公共标签
    public function parserAfter($content)
    {  
       ...
       $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;
 }下一篇:没有了!
 
点击排行
站长推荐
猜你喜欢
打赏本站
- 如果你觉得本站很棒,可以通过扫码支付打赏哦!
- 微信扫码:你说多少就多少~
 
- 支付宝扫码:你说多少就多少~
 
 
 
 
 
 
 
 


