虚位以待(AD)
虚位以待(AD)
首页 > CMS教程 > Discuz! > discuz帖子链接加内部跳转的方法

discuz帖子链接加内部跳转的方法
类别:Discuz!   作者:码皇   来源:互联网   点击:

看到有些网站在发帖加url的时候,会做内部跳转,跳转地址类似这样可以减少网站的导出链接,下面说下修改方法。找到文件:source function function_discuzcode php找到 ,魔客吧
看到有些网站在发帖加url的时候,会做内部跳转,跳转地址类似:http://www.moke8.com/ go.php?url=www.moke8.com,这样可以减少网站的导出链接,下面说下修改方法。

找到文件:source/function/function_discuzcode.php

找到这样一个函数:

[代码]php代码:

    function parseurl($url, $text, $scheme) {
    global $_G;
    if(!$url && preg_match("/((https?|ftp|gopher|news|telnet|rtsp|mms|callto|bctp|thunder|qqdl|synacast){
    1}
    ://|www.)[^["']+/i", trim($text), $matches)) {
    $url = $matches[0];
    $length = 65;
    if(strlen($url) > $length) {
    $text = substr($url, 0, intval($length * 0.5)).' ... '.substr($url, - intval($length * 0.3));
    }
    return ''.$text.'';
    }
    else {
    $url = substr($url, 1);
    if(substr(strtolower($url), 0, 4) == 'www.') {
    $url = 'http://'.$url;
    }
    $url = !$scheme ? $_G['siteurl'].$url : $url;
    return ''.$text.'';
    }
    }

将其修改为:

[代码]php代码:

    function parseurl($url, $text, $scheme) {
    global $_G;
    if(!$url && preg_match("/((https?|ftp|gopher|news|telnet|rtsp|mms|callto|bctp|thunder|qqdl|synacast){
    1}
    ://|www.)[^["']+/i", trim($text), $matches)) {
    $url = $matches[0];
    $length = 65;
    if(strlen($url) > $length) {
    $text = substr($url, 0, intval($length * 0.5)).' ... '.substr($url, - intval($length * 0.3));
    }
    return ''.$text.'';
    }
    else {
    $url = substr($url, 1);
    if(substr(strtolower($url), 0, 4) == 'www.') {
    $url = 'http://'.$url;
    }
    $url = !$scheme ? $_G['siteurl'].$url : $url;
    return ''.$text.'';
    }
    }

即可实现。

go.php写法:

[代码]php代码:








    相关热词搜索: discuz帖子链接加内部跳转的方法