Jensen9527 2017-02-25 01:28 采纳率: 9.1%
浏览 1523
已采纳

thinkphp3.1Call to a member function get() on null

请大家先看一下下面的问题,帮忙解决一下,谢谢啦!

本地搭建的php+nginx环境,thinkphp3.1的框架。

      Call to a member function get() on null D:\phpStudy\WWW\qj\ThinkPHP\Extend\Driver\TagLib\TagLibGyfx.class.php 第 589 行.
    错误位置

    FILE: D:\phpStudy\WWW\qj\ThinkPHP\Lib\Core\Think.class.php  LINE: 277
    TRACE

    [17-02-25 08:51:02] D:\phpStudy\WWW\qj\ThinkPHP\Lib\Core\Think.class.php (277) halt(Call to a member function get() on null D:\phpStudy\WWW\qj\ThinkPHP\Extend\Driver\TagLib\TagLibGyfx.class.php 第 589 行.)
    [17-02-25 08:51:02] D:\phpStudy\WWW\qj\ThinkPHP\Lib\Core\Think.class.php (292) Think::appError(1, Call to a member function get() on null, D:\phpStudy\WWW\qj\ThinkPHP\Extend\Driver\TagLib\TagLibGyfx.class.php, 589)
    [17-02-25 08:51:02] () Think::fatalError()

    ThinkPHP3.1.2 { Fast & Simple OOP PHP Framework } -- [ WE CAN DO IT JUST THINK ]

本地自定义标签文件目录
D:\phpStudy\WWW\qj\ThinkPHP\Extend\Driver\TagLib\TagLibGyfx.class.php
图片说明

问题所在代码

    /**
     * 自定义主导航标签
     * <gyfx:navigation name='navigation' row='8' position="middle"></gyfx:navigation>
     * @param type $attr
     * @param type $content
     */
    public function _navigation($attr, $content){
        $parseStr = '';
        $tag = $this->parseXmlAttr($attr, 'navigation');
        //dump($tag);die();
        $name = $tag['name'];
        $row = !empty($tag['row']) ? $tag['row'] : '12';
        $position = !empty($tag['position']) ? $tag['position'] : 'top';
        //实例化缓存
        if(C('DATA_CACHE_TYPE') == 'MEMCACHED' && C('MEMCACHED_OCS') == true){
            $memcaches = new Cacheds();
        }else{
            $memcaches = new Caches();
        }
        //生成一个用来保存 namespace 的 key  
        if($memcaches->getStat()){
            $ns_key = $memcaches->C()->get(CI_SN."_namespace_key");  
            //如果 key 不存在,则创建,默认使用当前的时间戳作为标识
            if($ns_key===false) $memcaches->C()->set(CI_SN."_namespace_key",time());  
        }
        //根据tag获取缓存key
        $cache_key = json_encode($tag).CI_SN;
        $cache_key = $ns_key.$cache_key;
        if($memcaches->getStat() && ini_get('memcache.allow_failover')&& $ary_return = $memcaches->C()->get($cache_key)){
            $list = json_decode($ary_return,true);

        }else{
            $list = D("Nav")->where(array('n_status'=>'1','n_position'=>$position))
            ->field('n_id as nid,n_name as nname,n_url as nurl,n_target as ntarget, n_order as norder ')
            ->order(array('n_order' => 'asc'))->limit($row)->select();
            //处理数据
            if(!empty($list) && is_array($list)){
                foreach($list as &$slist){
                    if(strstr($slist['nurl'],"?")){
                        $slist['nurl'] = 

    $slist['nurl'].'&name='.$slist['nname'];
                        }else{
                            $slist['nurl'] = $slist['nurl'];
                        }
                    }
                }
                if($memcaches->getStat() && ini_get('memcache.allow_failover')){
                    $memcaches->C()->set($cache_key,json_encode($list));
                }
            }
            $count = count($list);
            $str_list = var_export($list, true);
            $parseStr = $parseStr . "<?php $$name = " . $str_list . "; ?>";
            $parseStr = $parseStr . "<?php \$nav_count = " . $count . "; ?>";
            $parseStr = $parseStr . '<volist name="nav" id="' . $name . '" >' . $content . '</volist>';
            return $parseStr;
        } 

**第589行:$ns_key = $memcaches->C()->get(CI_SN."_namespace_key");

图片说明
我打印到那一步都是好的,再往下就出现题目的错误了。587行,我刚更新的截图

图片说明

  • 写回答

1条回答 默认 最新

  • Jensen9527 2017-02-25 03:09
    关注

    图片说明

    问题终于解决了

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 gis中用栅格计算器或加权总和后图层不显示,值也明显不对
  • ¥15 python使用python-pptx如何给幻灯片添加只读密码。
  • ¥15 深度神经网络传递自变量损失
  • ¥15 删除s的前驱节点,但是不知道错哪里了
  • ¥15 oracle数据库备份表如何操作
  • ¥15 软件定义网络mininet和onos控制器问题
  • ¥15 微信小程序 用oss下载 aliyun-oss-sdk-6.18.0.min client报错
  • ¥15 ArcGIS批量裁剪
  • ¥15 labview程序设计
  • ¥15 为什么在配置Linux系统的时候执行脚本总是出现E: Failed to fetch http:L/cn.archive.ubuntu.com