for ($i = 0; $i < $count; $i++) {
$this->data["schedule_count"] = $count;
$this->data["user_travels" . $i] = $this->travel_order_model->get_travel_schedule($this->data["user_dates"]{$i}->id);
}
错误:
遇到PHP错误
严重性:注意
消息:未定义的变量:user_travels
文件名:travel_order / travel_order_report_summary.php
行号:212
遇到PHP错误
严重性:警告
消息:为foreach()提供的参数无效
文件名:travel_order / travel_order_report_summary.php
行号:213
答案 0 :(得分:1)
for ($i = 0; $i < $count; $i++) {
$this->data["schedule_count"] = $count;
$this->data["user_travels"][$i] = $this->travel_order_model->get_travel_schedule($this->data["user_dates"][$i]->id);
}
$this->load->view('your_view_file', $data);
您的查看文件,您可以通过这种方式打印数据,
foreach($user_travels as $travelData){
print_r($travelData);
}
答案 1 :(得分:1)
for ($i = 0; $i < $count; $i++) {
$this->data["schedule_count"] = $count;
// pass Id
$this->data["user_travels"][$i] = $this->travel_order_model->get_travel_schedule($this->data["user_dates"][$i]->getId());
}