Rumah >pembangunan bahagian belakang >tutorial php >【ThinkPHP】诡谲的现象,$this->rowUser['ext'] = ''无法赋值!但是array_merge 却可以
【ThinkPHP】诡异的现象,$this->rowUser['ext'] = '';无法赋值!但是array_merge 却可以!
遇到一个非常匪夷所思的事情,在thinkphp3.1.3里面。
<br /><?php<br /><br />/**<br /> * Class UserAction by <[email protected]><br /> */<br />class UserAction extends InitAction<br />{<br /><br /> public function index()<br /> {<br /> $where = array(<br /> 'mid' => array('eq', $this->getUid())<br /> );<br /> $this->rowUser = M('Member')->where($where)->find();<br /><br /> //测试1<br /> $this->rowUser['ext'] = '名字4';<br /> dump($this->rowUser); //里面没有ext这个键!<br /><br /> //测试2 有<br /> $arr['ext'] = '名字4';<br /> $this->rowUser = array_merge($arr, $this->rowUser);<br /> dump($this->rowUser); //里面有ext这个了<br /><br /> //测试3 <br /> $this->rowUser2 = array(<br /> 'a' => 'A',<br /> 'b' => 'B',<br /> );<br /> $this->rowUser2['ext'] = '3333';<br /> dump($this->rowUser2); //里面也没有ext这个<br /> die;<br /> }<br />}<br />