就是这样。我已经正常烘焙了蛋糕 php 应用程序。该站点在本地服务器上运行良好。但是当迁移到 bluehost 服务器时,它开始在 hasmany 中出现问题并且属于关联。我发现的问题基本上是在包含数据的数组中。例如 $comments 通常有数据
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] => 你好是第二个[创建] => 2012-04-10 18:41:43 [修改] => 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))
因此最终显示以下错误
未定义索引: Post [APP/View/Comments/index.ctp, line 24] 第24行是
<?php echo $this->Html->link($comment['Post']['title'], array('controller' => 'posts', 'action' => 'view', $comment['Post']['id']));
请告诉解决这个问题?