私の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
}
?>
Iデルの場合このforeach
機能をETE、ページが正しく表示されますが、私はそれを置く場合は、ページがロードしてThis site can’t be reached
を示すとChromeのコンソールが
私は何をすべきGET http://localhost/anandadhara/district_circulars/ net::ERR_CONNECTION_RESET
を示していませんか?
UPDATE
1マイ.htaccess
私はwampserver使用しています
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /anandadhara/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
</IfModule>
を次のように2.2
UPDATE 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
}
?>
しかし、私は...
<td><?php echo $dt_circulars->id; ?></td>
<td><?php echo $dt_circulars->memo_no; ?></td>
または私はここで2つだけ空白のHTMLタグをつけていても...
<td></td>
<td></td>
のようにこちらのページを超える1つのフィールドを示す場合ERR_CONNECTION_RESETが表示され、connection_reset
ページのブラウザの空白ページが表示され、データが表示されません。
私はここで何が起こっているのか理解できません。
ローディングモードが不足しているようですl。 '$ this-> load-> model( 'content_model');' – jagad89
いいえ、私のモデル '$ this-> load-> model( 'content_model');を' public function __construct(){} 'にロードしました – Raj
'var_dump($ dt);を試してください。 $ dt ['dist_circulars'] = $ this-> content_model-> get_all_district_circulars(); 'の後ろに置かれます。それは空に戻るかもしれません。 – jagad89