namespace Addons\Wdingzhi\Controller;
use Home\Controller\AddonsController;
class BaseController extends AddonsController {
这种写法看不懂呀 我始终不明白为什么AddonsController这个为什么不是namespace的
回复讨论(解决方案)
你的写法是错误的(或遗漏了什么)
所以不理解是正常的
你的写法是错误的(或遗漏了什么)
所以不理解是正常的
<?php
namespace Addons\Wdingzhi\Controller;
use Home\Controller\AddonsController;
class BaseController extends AddonsController {
function _initialize() {
parent::_initialize();
class BaseController extends Home\Controller\AddonsController {
...
}
这是正确的
use Home\Controller\AddonsController;
class BaseController extends AddonsController {
...
}
是错误的
use Home\Controller\AddonsController as AddonsController;
class BaseController extends AddonsController {
...
}
或
use Home\Controller\AddonsController;
class BaseController extends Controller\AddonsController {
...
}
才是正确的
class BaseController extends Home\Controller\AddonsController {
...
}
这是正确的
use Home\Controller\AddonsController;
class BaseController extends AddonsController {
...
}
是错误的
use Home\Controller\AddonsController as AddonsController;
class BaseController extends AddonsController {
...
}
或
use Home\Controller\AddonsController;
class BaseController extends Controller\AddonsController {
...
}
才是正确的