咨询一个关于公共common下的问题
我在创建了application\common\controller\base.php想给index\controller\index.php继承,但是没有一点反应。请老师帮忙解答一下。版本用的th5.1最新的。
源码如下:


但是访问没有任何输出
正在回答 回答被采纳积分+1
<?php
namespace app\index\controller;
use app\common\controller\Adminbase;
class Index extends Adminbase
{
function Index(){
return time();
}
}<?php
namespace app\common\controller;
use think\Controller;
/**
* Base基类控制器
*/
class Base extends Controller{
/**
* 初始化方法
*/
public function _initialize(){
}
}<?php
namespace app\common\controller;
use app\common\controller\Base;
/**
* admin 基类控制器
*/
class Adminbase
extends Base
{
public function _initialize()
{
parent::_initialize();
$this->success("继承成功");
}
}有什么问题么?
<?php
namespace app\index\controller;
use app\common\controller\Adminbase;
class Index extends Adminbase
{
function Index(){
return time();
}
}
<?php
namespace app\common\controller;
use think\Controller;
/**
* Base基类控制器
*/
class Base extends Controller{
/**
* 初始化方法
*/
public function _initialize(){
}
}
<?php
namespace app\common\controller;
use app\common\controller\Base;
/**
* admin 基类控制器
*/
class Adminbase
extends Base
{
public function _initialize()
{
parent::_initialize();
$this->success("继承成功");
}
}

已经设置虚拟域名,但是任然无效
相似问题
登录后可查看更多问答,登录/注册
- 参与学习 人
- 提交作业 225 份
- 解答问题 3372 个
掌握用PHP开发互联网网站的必备功能,掌握当下主流的Linux系统开发,并熟练使用热门框架ThinkPhp开发电商团购项目,是通向PHP工程师必经之路。
了解课程

恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星