$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']获取价值:
尝试过:


$data['getTestData'][0]['TestDesc']
$data['getTestData'][0][0]['TestDesc']
$data['getTestData']['TestDesc']

最佳答案

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


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


简而言之:
 -如果是Array,则使用[]
 -如果是Object,则使用->

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

10-11 05:24