는이 같은 배열을 반환하는 모델을 가지고 :문제, codeigninter
array(1) { [0]=> array(4) { ["report_title"]=> string(7) "Test #1" ["content"]=> string(24) "This is a test" ["author"]=> string(6) "Thomas" ["create_date"]=> string(10) "1304969836" } }
그리고 내 컨트롤 :
$report_id = $this->uri->segment(3);
$report = $this->Report_model->getReport($report_id, $company_id);
if(!$report)
{
// TODO: fix this if the getReports returns FALSE;
} else {
$data['report'] = $report;
}
$this->load->view('user/report_read', $data);
내 문제는 내가 변수를 사용할 수 없다는 것입니다 내 견해로. 나는 다른 방법을 시도해 봤지만 일할 수는 없습니다.
내보기.
echo $report['report_title']; // Error: Message: Undefined index: report_title
echo $report_title; // Error: Undefined variable: report_title
어떻게 문제를 해결할 수 있습니까?
귀하의'$의 data'은 배열입니다 (배열 (datas ...)) 그래서 당신은'$ 보고서 [0] [ 'REPORT_TITLE를']'시도 할 수 있습니다. – Aif