CakePHP发现无法正确返回 - 缺少模型名称 [英] CakePHP find not returning correctly - missing model name

查看:93
本文介绍了CakePHP发现无法正确返回 - 缺少模型名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在模型上执行查找后,我期望结果为

的格式

  Array 

[0] => Array

[ModelName] => Array

[id] => 83
[field1] => value1
[field2] => value2
[field3] => value3



 <$ c> 

$ c> Array

[0] => Array

[0] => Array

[id] => ; 83
[field1] => value1
[field2] => value2
[field3] => value3




请注意缺少的型号名称。



我只是遇到这个问题,因为迁移到看起来是一个配置非常差的VPS,我现在可以完全控制。



我的问题是,我不能想到会导致这个问题的任何事情。任何想法非常感激。

解决方案

结果非常类似



同样,问题是过期的pdo_mysql版本。



strings -f pdo_mysql.so | grep':table'



如果没有结果,pdo_mysql很可能是由于安装

  pecl install pdo_mysql 

我的修复是一个简单的修复

  yum install php53-mysql 
pre>

我希望这有助于某人。


After performing a find on a model I would expect the result to be of the format

Array
(
    [0] => Array
        (
            [ModelName] => Array
                (
                    [id] => 83
                    [field1] => value1
                    [field2] => value2
                    [field3] => value3
                )    
        )
)

However, what I appear to be getting is

Array
(
    [0] => Array
        (
            [0] => Array
                (
                    [id] => 83
                    [field1] => value1
                    [field2] => value2
                    [field3] => value3
                )

        )
)

Note the missing model name.

I've only been getting this problem since migrating across to what appears to be a very poorly configured VPS that I now have full control over.

My problem is, I can't think of anything that would cause this problem. Any ideas greatly appreciated.

解决方案

Turns out to be very similar to this.

Again the problem was with an outdated pdo_mysql version.

This can be checked by running

strings -f pdo_mysql.so | grep ': table'

If there are no results then pdo_mysql is out of date most likely due to an installation such as

pecl install pdo_mysql

My fix was an easy one

yum install php53-mysql

I hope that this helps someone.

这篇关于CakePHP发现无法正确返回 - 缺少模型名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆