我的codeigniter
未显示页面。Codeigniter未显示数据,页面未显示
型号
function get_all_district_circulars()
{
$this->db->select('*');
$this->db->from('district_circulars');
$this->db->where('status', 1);
$this->db->order_by('id', 'desc');
$query = $this->db->get();
return $query->result();
}
控制器指数函数
public function index()
{
$dt['dist_circulars'] = $this->content_model->get_all_district_circulars();
$this->load->view('parts/top');
$this->load->view('parts/header');
$this->load->view('parts/nav');
$this->load->view('district_circulars', $dt);
$this->load->view('parts/footer');
}
查看
<?php
foreach($dist_circulars as $dt_circulars){
?>
<tr>
<td></td>
</tr>
<?php
}
?>
如果我德尔ETE此foreach
功能,页面能否正常显示,但如果我把它时,页面没有加载和显示This site can’t be reached
和Chrome控制台显示GET http://localhost/anandadhara/district_circulars/ net::ERR_CONNECTION_RESET
我应该怎么办?
更新1
我.htaccess
如下
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /anandadhara/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
</IfModule>
我使用wampserver 2.2
更新2
我的文件名是district_circulars.php
。
CLASS
:
class District_circulars extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->model('content_model');
}
另一个更新
,如果我在这里显示一个结果,它工作正常。
<?php
foreach($dist_circulars as $dt_circulars){
?>
<tr>
<td><?php echo $dt_circulars->id; ?></td>
</tr>
<?php
}
?>
但是,如果我表现出超过1场喜欢这里......
<td><?php echo $dt_circulars->id; ?></td>
<td><?php echo $dt_circulars->memo_no; ?></td>
或者,即使我把仅有的两个空白的HTML标签在这里...
<td></td>
<td></td>
页显示ERR_CONNECTION_RESET并显示页面为connection_reset
的浏览器空白页,并显示无数据。
我不明白这里发生了什么。
看来你错过了加载模式湖'$ this-> load-> model('content_model');' – jagad89
不,我在我的模型中加载了'$ this-> load-> model('content_model');'in'public function __construct(){}' – Raj
尝试'var_dump($ dt); die;'在'$ dt ['dist_circulars'] = $ this-> content_model-> get_all_district_circulars();'之后'。它可能会返回空。 – jagad89