discuz mobile 接口加载过程

来源:互联网 发布:手机淘宝为什么登不上 编辑:程序博客网 时间:2024/05/22 15:58

域名/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
原创粉丝点击