db->from("panTab"); $this->db->where("QCJobPanelTestId = ",$T-6ren">
gpt4 book ai didi

php - 无法访问 Controller 中的 $data 值

转载 作者:行者123 更新时间:2023-11-29 20:36:29 24 4
gpt4 key购买 nike

$this->db->select("*");
$this->db->from("panTab");
$this->db->where("QCJobPanelTestId = ",$TestId);
$query = $this->db->get();
$data['get_JobPan_Data'] = $query->result();

for($i = 0; $i < sizeof($data['get_JobPan_Data']);$i++)
{
$table = "Form1";
$whereField1 = "QC1TestId";
$whereField2 = "QC1JobPanelId";
$currDiv = "form1";
$this->db->select("*");
$this->db->from($table);
$this->db->where($whereField1." = ",$TestId);
$this->db->where($whereField2." = ",$data['get_JobPan_Data'][$i]['QCJobPanelId']); //--This value gives an error . How to access it?
$query1 = $this->db->get();
$data['getTestData'] = $query1->result();
}

即将到来的数据

 Array ( 
[get_JobPan_Data] => Array (
[0] => stdClass Object(
[QCJobPanelId] => 293 [QCJobPanelNo] => 1
[QCJobPanelDesc] => Pan 1
[QCJobPanelJobId] => 3
[QCJobPanelPanelId] => 0
[QCJobPanelTestId] => 63
)
[getTestData] => Array (
[0] => stdClass Object (
[QC1Id] => 77
[QC1JobId] => 3
[QC1TestId] => 63
[QCTestDesc] => 0
[QC1DielectricACC_LC] => 0
[QC1DielectricACC_IRA] => 0
[QCRemark] => Completed
[QCTestedBy] => aa
[QCReviewedBy] => bb
[QCWitnessedBy] => cc
[QC1JobPanelId] => 293
[QCTestCompletionDate] => 2016-07-29 00:00:00
[QC1DateAdded] => 2016-07-29
)
)
)

也无法从 $data['getTestData'] 获取值:
尝试过:

  1. $data['getTestData'][0]['TestDesc']
  2. $data['getTestData'][0][0]['TestDesc']
  3. $data['getTestData']['TestDesc']

最佳答案

访问 $data 的答案,包括 @Anish 和 @Anant 的帮助:

  • $data['getTestData'][0]->TestDesc
  • ResultVariable[Array1][Array2]->对象变量

简而言之: - 如果是数组,则使用 []
- 如果是对象,则使用 ->

关于php - 无法访问 Controller 中的 $data 值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38780959/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com