小编you*_*iri的帖子

如何访问对象数据php cakephp 3.1

这是一个cakephp 3.1查询结果,我想直接访问$ data-> items但是我得到一个错误,说找不到关键项,我不想使用funtcion toArray(),因为如果我这样做的话将仅返回'items'=> ...并且我丢失了所有'query'=> ...信息.你能用正确的语法来帮助我获得$ data-> items或$ data - > {'items'} ....

$data = object(Cake\ORM\ResultSet) {

    'query' => object(Cake\ORM\Query) {

        '(help)' => 'This is a Query object, to get the results execute or iterate it.',
        'sql' => 'SELECT Posts_types.id AS `Posts_types__id`, Posts_types.name AS `Posts_types__name` FROM posts_types Posts_types ORDER BY id ASC',
        'params' => [],
        'defaultTypes' => [
            'Posts_types.id' => 'integer',
            'id' => 'integer',
            'Posts_types.name' => 'string',
            'name' => 'string'
        ],
        'decorators' => (int) 0,
        'executed' => true,
        'hydrate' …
Run Code Online (Sandbox Code Playgroud)

php cakephp

2
推荐指数
1
解决办法
5273
查看次数

标签 统计

cakephp ×1

php ×1