<小时 />错误:
遇到 PHP 错误严重性:通知
- 消息:未定义的变量:卡利菲卡西酮
- 消息:为 foreach(( 提供的参数无效
- 怎么了?
- 在
Controller
中创建变量:$data['calificacione']
- 并在观点上呼吁
foreach
我的观点:
<table class="table table-condensed table-striped">
<thead>
<tr>
<th>Calificacione</th>
</tr>
</thead>
<tbody>
<?php
foreach ($calificacione as $key => $value) {
echo "<pre>";print_r($value);echo "</pre>";
}
?>
<tr>
<td><?php ?></td>
</tr>
<?php } ?>
</tbody>
</table>
我的控制器
class Provedore extends CI_Controller{
function __construct()
{
parent::__construct();
$this->load->model(['Provedore_model','Provedor_calificacione_model','Provedor_calificacione_model','Personas_contato_model','Direcione_model']);
}
/*
* Listing of all provedores
*/
function index()
{
$data['provedores'] = $this->Provedore_model->get_all_provedores();
$data['calificacione'] = $this->Provedor_calificacione_model->get_all_provedor_calificaciones();
$data['_view'] = 'provedore/index';
$this->load->fullView('layouts/main',$data);
}
请检查下面提到的可能性。
您是否从模型获取数据或任何错误。
var_dump($data['calificacione']);
die;
$data['_view'] = 'provedore/index';
$this->load->fullView('layouts/main',$data);
请分享您的输出,以便我们为您提供帮助。
在你的
模型中Provedore_model
get_all_provedores
可能有一些参数,比如
function get_all_provedores ($argument)
{
// your database query
}
而你没有满足这个论点
//try this
function index()
{
$provedores = $this->Provedore_model->get_all_provedores();
$data['provedores'] = $provedores;
$calificacione = $this->Provedor_calificacione_model->get_all_provedor_calificaciones();
$data['calificacione'] = $calificacione;
$this->load->view('layouts/main',$data)
$this->load->view('provedore/index',$data)
}