ThinkPHP 出鬼了!匪夷所思的问题,无法解释

浏览:544 发布日期:2014/05/29 分类:求助交流 关键字: 无法赋值 出鬼
数组直接 $this->rowUser['ext']='dddd'; 无法赋值成功!但是用array_merge却可以!
这是为什么?<?php

/**
 * Class UserAction by <admin@zbphp.com>
 */
class UserAction extends InitAction
{

    public function index()
    {
        $where = array(
            'mid' => array('eq', $this->getUid())
        );
        $this->rowUser = M('Member')->where($where)->find();

        //测试1
        $this->rowUser['ext'] = '名字4';
        dump($this->rowUser); //里面没有ext这个键!

        //测试2 有
        $arr['ext'] = '名字4';
        $this->rowUser = array_merge($arr, $this->rowUser);
        dump($this->rowUser); //里面有ext这个了

        //测试3 
        $this->rowUser2 = array(
            'a' => 'A',
            'b' => 'B',
        );
        $this->rowUser2['ext'] = '3333';
        dump($this->rowUser2); //里面也没有ext这个
        die;
    }
}
最佳答案
评论() 相关
后面还有条评论,点击查看>>