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个回答

图片说明

问题终于解决了

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!