CodeIgniter simple example
application\controllers\Boundtest.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Boundtest extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->model('Go');
}
public function boundview()
{
//zino
$data['output']=$this->Going_Model->get_user($ID);
$this->load->view('Boundtest',$data);
}
}
application\models\Go.php
<?php
class Going extends CI_Model {
public function __construct()
{
parent::__construct();
}
public function get_user($id)
{
//zino
$sql = 'SELECT * FROM `member`';
return $query = $this->db->query($sql)->result();
}
}
application\views\Boundtest.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<h1>test</h1>
<p><?php var_dump($output) ?> </p>
</body>
</html>
application\config\routes.php
$route['bound'] = 'Boundtest/boundview';
沒有留言:
張貼留言