cake php 2 model query()删除初始数组项

mwyxok5s  于 2021-09-29  发布在  Java
关注(0)|答案(0)|浏览(220)

使用在cake 2模型上执行sql查询时 ->query() ,由于某种原因,有一个初始数组,这意味着我必须继续指定 [0] 在访问数据之前,理想情况下,我希望先访问模型的数组数据,而不是此数组,我缺少什么?
当前,我的查询如下所示:

$appID = htmlspecialchars($redirect['Redirect']['application_id']);
$applicationPayday = $this->Application->query("
    SELECT *
    FROM tlp_applications AS Application
    INNER JOIN tlp_application_paydays AS ApplicationPayday
    ON Application.id = ApplicationPayday.application_id
    WHERE Application.id = $appID
");

当我倾倒 $applicationPayday 我看到以下结构:

array(1) {
  [0]=>
  array(2) {
    ["Application"]=>
    array(13) {
      ["id"]=>
      string(8) "38270050"
      ...
    }
    ["ApplicationPayday"]=>
    array(107) {
      ["id"]=>
      string(8) "38153199"
      ["application_id"]=>
      string(8) "38270050"
      ...
    }
  }
}

理想情况下,我希望:

array(2) {
  ["Application"]=>
  array(13) {
    ["id"]=>
    string(8) "38270050"
    ...
  }
  ["ApplicationPayday"]=>
  array(107) {
    ["id"]=>
    string(8) "38153199"
    ["application_id"]=>
    string(8) "38270050"
    ...
  }
}

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题