CakePHP2.1 find('all')无法在return Array中找到ModelName [英] CakePHP2.1 find('all') can't find ModelName in return Array

查看:250
本文介绍了CakePHP2.1 find('all')无法在return Array中找到ModelName的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在cakePHP中执行了以下查询: $ this-> {ModelName} - > find('all')

I did the following query in cakePHP : $this->{ModelName}->find('all') , and it returned an array like this :

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

而不是正确的显示,应该是这样:

Instead of the correct display which is supposed to be like that :

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

CakePhp版本是2.1

CakePhp version is 2.1

答:不要使用PDO_MYSQL-1.0.2.tgz,请使用--with-pdo-mysql。 strong>

A:Don't use PDO_MYSQL-1.0.2.tgz,please use --with-pdo-mysql.

推荐答案

您可以检查您的服务器是否满足cakephp的最低要求?

Can you check if your server meets the minimums requirements for cakephp ?


需求



  • HTTP服务器。例如:Apache。 mod_rewrite是首选,但不是必需的。

  • PHP 5.2.8或更高版本。
  • Requirements

  • HTTP Server. For example: Apache. mod_rewrite is preferred, but by no means required.
  • PHP 5.2.8 or greater.
  • 技术上不需要数据库引擎,大多数应用程序将使用一个。 CakePHP支持各种数据库存储引擎:

  • MySQL(4或更高版本)

  • PostgreSQL

  • Microsoft SQL Server

  • SQLite

  • 注意
    内置驱动程序都需要PDO。您应该确保您已安装了正确的PDO扩展。

    Technically a database engine isn’t required, but we imagine that most applications will utilize one. CakePHP supports a variety of database storage engines:

  • MySQL (4 or greater)
  • PostgreSQL
  • Microsoft SQL Server
  • SQLite
  • Note : The built-in drivers all require PDO. You should make sure you have the correct PDO extensions installed.

    http://book.cakephp.org/2.0/en/installation.html#Requirements

    您可以在php phpinfo()中的内置函数中检查当前版本。只要写在任何页面。也检查你的php.ini文件,看看你正在使用的数据库的pdo扩展是否安装正确

    You can check your current version within the built-in function in php phpinfo(). Just write it in any page. Also check your php.ini file to see if the pdo extension for the database your are using is installed correctly

    这篇关于CakePHP2.1 find('all')无法在return Array中找到ModelName的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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