• 全国400电话网上服务平台
    强大号码库资源任选,方便,快捷,快速开通。
    咨询热线:400-1100-266  

    织梦CMS下载地址如何全局调用函数
    POST TIME:2020-03-28 19:08

    大家可以看到大多数的下载站在软件下载地址处使用的是全局调用函数来实现的,可以这样说很多的朋友不是太明白,我们还是先来看一张效果图(如下),大家应该明白我的意思了吧。下面是我从网上搜集来的相关调用实例,供大家学习研究。

    1. <?php
    2. /*-------------------------------
    3. Content:软件内容页下载地址调用
    4. Author:爱哭的鱼(QQ:842974118)
    5. WebSite:一条龙建站(http://www.genban.org)
    6. UpDateTime:2010-07-17
    7. ==========
    8. Tigs:
    9. 调用方法:{dede:field.idfunction="getsoftlinks(3,1,@me)"}
    10. 参数说明:
    11. 1.$channelid是内容模型的ID;
    12. 2.调用类型(1=本地;2=镜像列表)
    13. 3.@me为当前值,也是软件的文档ID编号
    14. --------------------------------*/
    15. functiongetsoftlinks($channelid,$type,$aid){
    16. global$dsql;
    17. $goto=$dsql->GetOne("Select*From`dede_softconfig`");
    18. $channeltable=$dsql->GetOne("select*from`dede_channeltype`whereid=$channelid");
    19. $addtable=$channeltable['addtable'];
    20. $row=$dsql->GetOne("select*from`".$addtable."`whereaid=$aid");
    21. if($type==1){//设置条件为调用本地下载
    22. if($row['softlinks']!=''){//判断下载地址是否为空;
    23. $dtp=newDedeTagParse();
    24. $dtp->LoadSource($row['softlinks']);
    25. foreach($dtp->CTagsas$ctag){
    26. if($ctag->GetName()=='link'){//读取{dede:link}的标签
    27. $link=trim($ctag->GetInnerText());//链接地址为底层模板;
    28. $serverName=trim($ctag->GetAtt('text'));//服务器名称
    29. $islocal=trim($ctag->GetAtt('islocal'));//是否为本地的判断
    30. if($islocal==1){//本地下载链接
    31. if($goto['gotojump']==1){//如果后台设置为链接到跳转页面,则对下载地址进行再次处理
    32. $uhash=substr(md5($link),0,24);
    33. $links="/plus/download.php?open=2&id=$aid&uhash=$uhash";
    34. }
    35. return$links;
    36. }
    37. }
    38. }
    39. }
    40. }
    41. elseif($type==0){
    42. if($row['softlinks']!=''){//判断下载地址是否为空;
    43. $dtp=newDedeTagParse();
    44. $dtp->LoadSource($row['softlinks']);
    45. if(is_array($dtp->CTags)){
    46. foreach($dtp->CTagsas$ctag){
    47. if($ctag->GetName()=='link'){//读取{dede:link}的标签
    48. $link=trim($ctag->GetInnerText());//链接地址为底层模板;
    49. $serverName=trim($ctag->GetAtt('text'));//服务器名称
    50. $islocal=trim($ctag->GetAtt('islocal'));//是否为本地的判断
    51. $rapidity=rand(0,70);
    52. if($rapidity==0){
    53. $line='stop';
    54. }
    55. elseif($rapidity<=20){
    56. $line='busy';
    57. }
    58. elseif($rapidity<=40){
    59. $line='nofree';
    60. }
    61. else{
    62. $line='free';
    63. }
    64. if($islocal!=1){
    65. if($goto['gotojump']==1){//如果后台设置为链接到跳转页面,则对下载地址进行再次处理
    66. $uhash=substr(md5($link),0,24);
    67. $link="/plus/download.php?open=2&id=$aid&uhash=$uhash";
    68. }
    69. $links="<tr><tdclass='line-name'><ahref='".$link."'target='_blank'>".$serverName."</a></td><td>链接速度:</td><tdclass='line-speed'><pclass='".$line."speed-bad'>".$rapidity."</p></td></tr>";
    70. $downlinks.=$links;
    71. }
    72. }
    73. }
    74. }
    75. $dtp->Clear();
    76. return$downlinks;
    77. }
    78. }
    79. else{
    80. return"调用参数错误";
    81. }
    82. }
    83. ?>
    
    关于我们 | 付款方式 | 建站知识 | 增值服务 | 网站模板
    Copyright © 2003-2016
    时间:9:00-21:00 (节假日不休)
    版权所有:巨人网络(扬州)科技有限公司
    总部地址:江苏省信息产业基地11号楼四层
    《增值电信业务经营许可证》 苏B2-20120278
    X

    截屏,微信识别二维码

    微信号:veteran88

    (点击微信号复制,添加好友)

     打开微信

    微信号已复制,请打开微信添加咨询详情!