harrisonjau 发表于 2012-12-15 14:38:32

extends 自已的 controller


<?php
class Comm_Controller extends CI_Controller
{
function __construct()
{
parent::__construct();
}

//其它方法
   public function hello_world()
   {
          echo "Hello World";
   }
}
//file under application/controllers
//file name comm.php

继承这个controller

<?php
include FCPATH.APPPATH.'controllers/comm.php';
class Myfirstcontroller extends Comm_Controller
{
   public function index()
    {
       $this->hello_world();
   }
}

尹胜台 发表于 2013-11-6 09:37:03

感谢仿照你的我的include 相对路径引入成功了 。include FCPATH.APPPATH.'controllers/comm.php';

我很奇怪 为什么在控制器中 引入上一级的不能用 include"../comm.php'"?


页: [1]
查看完整版本: extends 自已的 controller