如何在cakephp中获取取值

how to get fetch value in cakephp

        $map=$this->Sessiondetails->find("all");    
        $this->set("map",$map);
    foreach($map as $maps){ 
   echo $maps['Sessiondetails']['latitude'];
    }

我只想获取第 3 行的值。如何在 cakephp 中做到这一点。我正在使用 cakephp 2x。

在 SQL 你会怎么做?想想再用cake语法

http://book.cakephp.org/2.0/en/models/retrieving-your-data.html#retrieving-your-data

$map = $this->Sessiondetails->find(
    "all"
    array(
        'offset' => 2
        'limit' => 1
    )
);   

当然,如果您想要 运行 检索所有记录但仅显示第 3 条记录的查询,您可以简单地执行

echo $map[2]['Sessiondetails']['latitude'] 

你可以使用 2way

如果你使用 Paginator 组件,你可以使用这个:

$this->paginate = array('limit' => 10);

else : 

$map = $this->Sessiondetails->find(
    "all",
    array(
        'offset' => 2
        'limit' => 1
    )
); 

这对你有用,这里你只需要通过限制..

<?php 
$map=$this->Sessiondetails->find("all",array('limit'=>'2,1'););    
$this->set("map",$map);
foreach($map as $maps)
{ 
   echo $maps['Sessiondetails']['latitude'];
}
?>