Home >Backend Development >PHP Tutorial >如何在discuz的discuz.htm中调用当前登陆用户的主题、各项积分等信息
如何在discuz的discuz.htm中调用当前登陆用户的主题、各项积分等信息
目前已知的只有:$_G['member'][credits] 是当前用户的积分
\source\module\forum\forum_index.php
在这个页面中添加如下代码,在模板 discuz.htm 中直接调用就可以了
//威望,金钱 之类的可直接调用echo "<pre class="brush:php;toolbar:false">";print_r($_G['setting']['extcredits']);echo "";//当前用户的 主题信息列表$threadList = C::t('forum_thread')->fetch_all_by_authorid_displayorder($_G['uid']);echo "
";print_r($threadList);echo "";
\source\module\forum\forum_index.php
在这个页面中添加如下代码,在模板 discuz.htm 中直接调用就可以了
//威望,金钱 之类的可直接调用echo "<pre class="brush:php;toolbar:false">";print_r($_G['setting']['extcredits']);echo "";//当前用户的 主题信息列表$threadList = C::t('forum_thread')->fetch_all_by_authorid_displayorder($_G['uid']);echo "
";print_r($threadList);echo "";
怎么不行
怎么不行
//威望,金钱 之类的可直接调用foreach($_G['setting']['extcredits'] as $extcreditid=>$v){ //num 就是你要显示的值 $_G['setting']['extcredits'][$extcreditid]['num'] = getuserprofile('extcredits'.$extcreditid);}print_r($_G['setting']['extcredits']);
//威望,金钱 之类的可直接调用foreach($_G['setting']['extcredits'] as $extcreditid=>$v){ //num 就是你要显示的值 $_G['setting']['extcredits'][$extcreditid]['num'] = getuserprofile('extcredits'.$extcreditid);}print_r($_G['setting']['extcredits']);
数据都显示出来了,你循环啊
数据都显示出来了,你循环啊
数据都显示出来了,你循环啊
$_G['setting']['extcredits'][1]['num']
$_G['setting']['extcredits'][2]['num']
...
$_G['setting']['extcredits'][1]['num']
$_G['setting']['extcredits'][2]['num']
...
那你就把输出的地方去掉,print_r
你该多看看手册
你该多看看手册