discuz mobile 接口加载过程

域名/api/mobile/index.php?module=forumdisplay&fid=2
|
index.php 里面判断是否跳check.php或插件下的mobile.php
|
mobile.php 下有一句:require_once 'source/plugin/mobile/mobile.class.php'; 将mobile.class.php导入后执行
以下这段代码来判断要调用哪个接口
if(file_exists($apifile)) {

require_once $apifile;

} else {

if($_GET['version'] > 1) {

for($i = $_GET['version']; $i >= 1; $i--) {

$apifile = 'source/plugin/mobile/api/'.$i.'/'.$_GET['module'].'.php';

if(file_exists($apifile)) {

$_GET['version'] = $i;

require_once $apifile;

break;

} elseif($i==1 && !file_exists($apifile)) {

mobile_core::result(array('error' => 'module_not_exists'));

}

}

} else {

mobile_core::result(array('error' => 'module_not_exists'));

}

}
|
首页帖子则 调用api/1/forumdisplay.php 这个文件 ,而里面包含一句:

include_once 'forum.php';
当这一句被执行后,可以获取的首页帖子数据, 这些数据将放到$_G 缓存里面 ,再通过遍历取出



foreach($_G['forum_threadlist'] as $k => $thread) {


$_G['forum_threadlist'][$k]['cover'] = array();


if($thread['cover']) {


$_img = @getimagesize($thread['coverpath']);


if($_img) {


$_G['forum_threadlist'][$k]['cover'] = array('w' => $_img[0], 'h' => $_img[1]);


}


}


if(!$thread['authorid'] || !$thread['author']) {


$_G['forum_threadlist'][$k]['author'] = $_G['setting']['anonymoustext'];


$_G['forum_threadlist'][$k]['authorid'] = 0;


}


}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值