Cakephp 3.在查询数据库时,Windows和Linux操作系统返回不同的结果 [英] Cakephp 3. Windows and Linux OS returning different result when querying the database

查看:210
本文介绍了Cakephp 3.在查询数据库时,Windows和Linux操作系统返回不同的结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在我的本地机器上使用Windows 10与Cakephp 3的项目做了重要的工作。现在我决定移动到生产环境,一个运行Debian操作系统的服务器。

I have done significant work on a project on my local machine using Windows 10 with Cakephp 3. Now I have decided to move it onto production environment, a server which runs Debian OS.

我遇到了一个问题。在我的本地机器(Windows 10)下面的代码返回所有文章包括他们的评论。

I encountered an issue. On My local machine (Windows 10) The following code returns all Articles including their comments.

$this->Articles->find()->contain('Comments')

我期待的结果。然而,生产环境中的同一行代码返回一个不同的对象,其中包括数据库驱动程序和更多的数据。

All is fine by now and I got the result I am expecting. However the same line of code on the production environment is returning a different object which includes Database Driver and many more data.

附加了一个包含这两个结果的映像。左边是我的生产服务器上的结果,右边是我机器的结果。

attached an image which contains both results. On the left is the outcome on my production server and on the right the outcome from my machine.

任何想法可能是什么问题?

Any idea what could be the problem? Everything should be configured (Article belongsTo Comments etc...) as required as the application runs perfect on my local machine.

图片:

编辑:
是的,两个Cakephp版本是一样的。版本3.1.4

EDIT : Yes, Both Cakephp version are the same. Version 3.1.4

推荐答案

您可能在Debian服务器上有一个旧的PHP版本, __ debugInfo()方法(从PHP 5.6.0起可用),由Cakes Query类使用自定义信息装饰调试输出。

You probably have an older PHP version on your Debian Server, one that doesn't yet support the magic __debugInfo() method (available as of PHP 5.6.0), which is used by Cakes Query class to decorate the debug output with custom information.

如果你使用Cakes debug()函数,你应该得到相同的结果(AFAIR)。

If you'd use Cakes debug() function you should get identical results (AFAIR).

另请参阅

  • http://php.net/manual/en/language.oop5.magic.php#object.debuginfo
  • Source > \Cake\ORM\Query::__debugInfo()

这篇关于Cakephp 3.在查询数据库时,Windows和Linux操作系统返回不同的结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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