在Cakephp中从数组中检索值

在Cakephp中从数组中检索值,cakephp,cakephp-2.0,Cakephp,Cakephp 2.0,我试图从Cakephp中的数组中获取一些要显示的数据,该数组包含来自find()输出的所有数据以及数据输出的其他部分 我试图访问的数据是公司内部的名称字段,我使用的代码是echo$quote['company']['name'],但它返回并错误地指出索引未定义。代码echo$quote['Status']['name']工作正常 数组的内容如下所示 Array ( [Quote] => Array ( [id] => 3 [name] => Eighties Yeh

我试图从Cakephp中的数组中获取一些要显示的数据,该数组包含来自find()输出的所有数据以及数据输出的其他部分

我试图访问的数据是公司内部的名称字段,我使用的代码是
echo$quote['company']['name']
,但它返回并错误地指出索引未定义。代码
echo$quote['Status']['name']
工作正常

数组的内容如下所示

    Array ( 
[Quote] => Array ( [id] => 3 [name] => Eighties Yeh that aint right [revision] => 1 [status_id] => 1 [contact_id] => 1 [totalcost] => 500 [created] => 2010-01-20 13:26:36 ) [Status] => Array ( [id] => 1 [name] => Open 
[Quote] => Array ( [id] => 3 [name] => Eighties Yeh that aint right [revision] => 1 [status_id] => 1 [contact_id] => 1 [totalcost] => 500 [created] => 2010-01-20 13:26:36 
[0] => Array ( [id] => 3 [name] => Eighties Yeh that aint right [revision] => 1 [status_id] => 1 [contact_id] => 1 [totalcost] => 500 [created] => 2010-01-20 13:26:36 ) 

[1] => Array ( [id] => 4 [name] => Test [revision] => 12 [status_id] => 1 [contact_id] => 1 [totalcost] => 23 [created] => 2010-01-20 19:05:36 ) ) ) 
[Contact] => Array ( [id] => 1 [company_id] => 1 [name] => Kieran Hutchinson [email] => kieran@redmeetsblue.com.au 
[Company] => Array ( [id] => 1 [name] => Red Meets Blue ) 
[Quote] => Array ( [id] => 2 [name] => Test Quote 2 [revision] => 1 [status_id] => 0 [contact_id] => 1 [totalcost] => 300 [created] => 2010-01-17 10:30:31 
[0] => Array ( [id] => 2 [name] => Test Quote 2 [revision] => 1 [status_id] => 0 [contact_id] => 1 [totalcost] => 300 [created] => 2010-01-17 10:30:31 ) 
[1] => Array ( [id] => 5 [name] => test 4 [revision] => 1 [status_id] => 3 [contact_id] => 1 [totalcost] => 233 [created] => 2010-01-20 19:05:55 ) 
[2] => Array ( [id] => 3 [name] => Eighties Yeh that aint right [revision] => 1 [status_id] => 1 [contact_id] => 1 [totalcost] => 500 [created] => 2010-01-20 13:26:36 ) [3] => Array ( [id] => 4 [name] => Test [revision] => 12 [status_id] => 1 [contact_id] => 1 [totalcost] => 23 [created] => 2010-01-20 19:05:36 ) 
[4] => Array ( [id] => 6 [name] => Test Lost Quote [revision] => 1 [status_id] => 4 [contact_id] => 1 [totalcost] => 123 [created] => 2010-01-21 16:00:43 ) 
[5] => Array ( [id] => 7 [name] => Test Pending QUote [revision] => 1 [status_id] => 2 [contact_id] => 1 [totalcost] => 321 [created] => 2010-01-21 16:00:57 ) ) ) [QuoteItem] => Array ( ) ) 

从您的阵列中,您似乎需要通过
$quote['Contact']['Company']['name']

从您的阵列中,您似乎需要通过
$quote['Contact']['Company']['name']访问它