"thinkphp" strange Phenomenon, $this->rowuser[' ext '] = "; cannot be assigned! But Array_merge can! 
Met a very strange thing, in the thinkphp3.1.3 inside. 
 
 
  
/**
* Class useraction by <[email protected]>
*/
Class Useraction extends Initaction
{
    Public Function Index ()
    {
        $where = Array (
            ' Mid ' = = Array (' eq ', $this->getuid ())
        );
        $this->rowuser = M (' Member ')->where ($where)->find ();
        Test 1
        $this->rowuser[' ext '] = ' name 4 ';
        Dump ($this->rowuser); There is no ext this key!
        Test 2 has
        $arr [' ext '] = ' name 4 ';
        $this->rowuser = Array_merge ($arr, $this->rowuser);
        Dump ($this->rowuser); There's ext in there.
        
        $this->rowuser2 = Array (
            ' A ' = ' a ',
            ' B ' = ' B ',
        );
        $this->rowuser2[' ext '] = ' 3333 ';
        Dump ($this->rowuser2); There's no ext here either.
        Die
    }
}
 
 
What's going on here, it's weird! 
 
 
------Solution-------------------- 
This method must be in the class or in the inherited class, just as the method that accesses the class $this-> the method name. 
------Solution-------------------- 
If you have a __set, __get method defined in your useraction or its parent class, it is normal for this to happen. 
Because they might not be able to make the cards. 
------Solution-------------------- 
I've had the same problem. 
TP is assigned in the controller, in fact, the __set method is assigned to the Tvar variable of the view class. 
Then I discovered that the __set magic method has a bug that does not intercept an operation that assigns a value to an element of an array property directly: 
$this->arr[' a '] = 1; So in TP is directly to $this->arr assignment, and we read is actually from $this->view->tvar