Discuz!官方免费开源建站系统

 找回密码
 立即注册
搜索

[求助] 插件缓存问题

[复制链接]
莫问君愁 发表于 2012-5-10 16:14:31 | 显示全部楼层 |阅读模式
本帖最后由 莫问君愁 于 2012-5-10 16:29 编辑

发现一个奇怪的问题,插件前台的文件都可以读取$_G中缓存的变量,可是当你建一个插件的后台管理中心里,却无法获取插件缓存的变量值,这是为什么???
下面是我的代码,其中的$_G打头的变量,均无法取得相应的值,但是这些变量在插件的前台文件里,却能正常使用。
  1. if(!defined('IN_DISCUZ')||!defined('IN_ADMINCP')) {
  2.    exit('Access Deined');
  3. }
  4. global $_G;
  5. if (!isset($_G['cache']['plugin']['waterfall']))
  6. {
  7.         loadcache('waterfall');
  8. }
  9. $thumbwidth=$_G['cache']['plugin']['waterfall']['thumbwidth'];
  10. $thumbheight=$_G['cache']['plugin']['waterfall']['thumbheight'];

  11. $forumIDList=unserialize($_G['cache']['plugin']['waterfall']['forumidlist']);
  12. $forumIDListString=implode(",",$forumIDList);
  13. //所有已设置论坛版块
  14. $sql="select fid,name from ".DB::table('forum_forum')." where fid in (".$forumIDListString.")";
  15. $query=DB::query($sql);
  16. $forum=$forums=array();
  17. while($forum = DB::fetch($query))
  18. {
  19.         $forums[]=$forum;
  20. }

  21. if (($_GET['mod']=='build')&&(submitcheck('buildthumb')))
  22. {  
  23.         
  24. }
  25. include template('waterfall:buildthumb');
复制代码
回复

使用道具 举报

 楼主| 莫问君愁 发表于 2012-5-10 16:26:43 | 显示全部楼层
难道没人知道吗???
回复

使用道具 举报

 楼主| 莫问君愁 发表于 2012-5-12 15:36:31 | 显示全部楼层
此问题已解决
回复

使用道具 举报

听吧 发表于 2012-5-12 15:40:06 | 显示全部楼层
强烈感谢楼主
回复

使用道具 举报

lifetin 发表于 2012-5-23 11:08:14 | 显示全部楼层
怎么解决的呢?我也正遇到了.....
回复

使用道具 举报

lifetin 发表于 2012-5-23 14:07:25 | 显示全部楼层
自己解决了
送上解决办


        class Get{
        static $identifier;
                function __construct($identifier='box'){
                        $this->identifier = $identifier;
                }
               
        static function value($var){
                $plugin_id = DB::result_first('SELECT pluginid FROM ' . DB::table('common_plugin') . " WHERE identifier='box'");
                $value= DB::result_first('SELECT value FROM ' .DB::table('common_pluginvar'). " WHERE pluginid= $plugin_id AND variable='{$var}'" );
                return $value;
                }
               
        }
        $v = Get::value('total');
回复

使用道具 举报

lifetin 发表于 2012-5-23 14:08:11 | 显示全部楼层
$identifier='box'
box是你的唯一标识,
Get::value('total');
total是你要查的变量名!
回复

使用道具 举报

脚滑的狐狸 发表于 2014-10-11 20:52:50 | 显示全部楼层
谢谢楼主,我还以为前后台都有调用呢
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2025-8-25 09:54 , Processed in 0.129005 second(s), 15 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表