Phpzendframework data type conversion & nbsp; -- as follows & nbsp; $ result & nbsp; $ db-& gt; fetchAll & nbsp; (& nbsp; select & nbsp; * & nbsp; from & nbsp; albums & nbsp;); in this way, $ result obtains the structure of the Array. The data access method is $ resul php zendframework data type conversion.
-- As follows
$ Result = $ db-> fetchAll ("select * from albums ");
In this way, $ result is the structure of the Array, and the data access method is $ result ["key"], not a class object.
A new class $ albums = new Albums (); the way to access data is $ albums-> key
What I want to achieve is:
Convert the $ result data structure to the $ albums data structure.
I am using zend studio development tools, zend framework, and I want experts to answer my questions and wait online ......
------ Solution --------------------
Directly added to the $ db class.
$ Db-> key (); isn't it the same?
You need to create another Albums, initialize it, and export the resource handle or result array.
You cannot write this method either. key ()
If there is another method called key2, you can't finish it.
The method for writing a flexible point is getAttr ($ column)
$ Obj-> getAttr ("key2") for calling; not more flexible
Neither can I write ()
------ Solution --------------------
Convert an array to an object? Settype ()
------ Solution --------------------
Zend_Db_Table, Zend_Db_Table_Row, and Zend_Db_Table_Rowset
Http://blog.csdn.net/mengxiangbaidu/article/details/7854093