文件目录展示:
改动代码展示:
Controller.php
1 <?php 2 /** 3 * Created by PhpStorm. 4 * User: Interact 5 * Date: 2017/8/20 6 * Time: 12:04 7 */ 8 class Controller{ 9 protected function _initContentType(){ 10 header('COntect_type:text/html;charset=utf8'); 11 } 12 public function __construct() { 13 $this->_initContentType(); 14 } 15 }
zixun.controller.class.php展示:
1 <?php 2 //header('Content-type:text/html;charset=utf8'); 3 4 /** 5 * Created by PhpStorm. 6 * User: Interact 7 * Date: 2017/8/19 8 * Time: 18:37 9 */ 10 require 'Controller.php'; 11 class zixun extends Controller { 12 /** 13 * 方法show() 14 * @return string aaa 15 */ 16 public function show() { 17 // require 'zixunModel.class.php'; 18 // $zixunModel=new zixunModel(); 19 require './Factory.class.php'; 20 21 $zixunModel = Factory::M('zixunModel'); 22 23 $records = $zixunModel->getall(); 24 25 // var_dump($records); 26 require 'html/show.html'; 27 // return '12233'; 28 } 29 public function delete(){ 30 echo '真的删除啦,你别后悔!!!'; 31 } 32 33 }