class IndexModel{
public $data=array();
public function __construct(){
$conn=mysqli_connect('localhost','root','','myitem');
mysqli_query($conn,'set names utf8');
$sql="select * from describe";
$re= mysqli_query($conn, $sql);
$row=mysqli_fetch_assoc($re);
$this->data=$row;
}
}
class IndexController{
public function index(){
$total= file_get_contents('view/index.html');
require "model/IndexModel.class.php";
$db=new IndexModel();
$row=$db->data;
$total=str_replace('{title}', $row['webName'], $total);
$total=str_replace('{keywords}', $row['keyword'], $total);
$total=str_replace('{description}', $row['describe'], $total);
echo $total;
}
public function lists(){
$total= file_get_contents('view/list.html');
require "model/IndexModel.class.php";
$db=new IndexModel();
$row=$db->data;
$total=str_replace('{title}', $row['webName'], $total);
$total=str_replace('{keywords}', $row['keyword'], $total);
$total=str_replace('{description}', $row['describe'], $total);
echo $total;
}
public function content(){
$total= file_get_contents('view/news.html');
require "model/IndexModel.class.php";
$db=new IndexModel();
$row=$db->data;
$total=str_replace('{title}', $row['webName'], $total);
$total=str_replace('{keywords}', $row['keyword'], $total);
$total=str_replace('{description}', $row['describe'], $total);
echo $total;
}
}