<?php class Database1 extends CI_controller{ function __construct(){ parent:: __construct(); $this->load->database(); } function index(){ $data['records']=$this->db->get('profile')->result_array(); $this->load->view('database_view',$data); } }
<html> <body> <table> <?php foreach ($records as $row): ?> <tr> <td><?=$row['名前']?></td> <td><?=$row['性別']?></td> <td><?=$row['生年月日']?></td> </tr> <?php endforeach; ?> </table> </body> </html>
phpの質問です。このコントローラのコンストラクタはなぜ必要なのでしょうか。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/03/07 05:02