【发布时间】:2012-05-27 17:34:08
【问题描述】:
所以情况就是这样。 我已经正常烘焙了蛋糕 php 应用程序。该站点在本地服务器上运行良好。 但是当迁移到 bluehost 服务器时,它开始在 hasmany 中出现问题并且属于关联。 我发现的问题基本上是在包含数据的数组中。 例如 $cmets 通常有数据
Array ( [Comment] => Array ( [id] => 46 [name] => asddasd [email] => sdaa [网站] => asdasd [commentdata] => asdasd [postdate] => 2012-04 -27 08:20:00 [post_id] => 2 ) [Post] => Array ( [id] => 2 [title] => 战斗机 [category] => 军事 [description] => asddasdasdasdasdasd [body] = > 你好,这是第二个 [created] => 2012-04-10 18:41:43 [modified] => 2012-04-27 13:25:33 [user_id] => 0 ) )
但在网络服务器上看起来像
Array ( [Comment] => Array ( [id] => 8 [name] => ddasdasdsdasd [email] => asdasd [网站] => asdasd [commentdata] => adasdasdasdad [postdate] => 2012-04 -23 23:15:00 [post_id] => 8 ) )
因此最终显示以下错误
未定义索引:发布 [APP/View/Comments/index.ctp,第 24 行] 第 24 行是
<?php echo $this->Html->link($comment['Post']['title'], array('controller' => 'posts', 'action' => 'view', $comment['Post']['id']));
请告诉解决方法?
【问题讨论】:
-
这不是和你的另一个问题一样:stackoverflow.com/questions/10437939/…?
-
是的,它是一样的,但我没有为这个愚蠢的问题找到一个好的解决方案! .
-
您的 PC 上的 PHP 版本是什么,服务器上的 PHP 版本是什么?您的 PC 上是什么操作系统,服务器上是什么操作系统?你使用的是什么主机?他们支持你的设置吗?
-
两个cakephp的版本是一样的。我正在使用 Windows 电脑。并托管在 bluehost 上。他们支持设置。我猜 bluehost 使用的是 linux 操作系统
-
看看我在下面的答案中提供的链接。