yii autoload 文件层面重写

技术分享 · Fecmall · 于 2年前 发布 · 732 次阅读

1.controller

public function actionIndex()
    {
        \Yii::$classMap['common\models\shop\ShopSettings'] = '@custom/common/models/shop/ShopSettings.php';
        $data = ShopSettings::get('sysset.mall.share');

        return $this->success($data);
    }
	

2.CustomShopSettings

namespace common\models\shop;


$classFile= \Yii::getAlias('@common/models/shop/ShopSettings.php');
include $classFile;


/**
 * 店铺设置
 * Class ShopSettings
 * @package common\models\shop
 */
class CustomShopSettings  extends ShopSettings
{
    

}
共收到 0 条回复
没有找到数据。
添加回复 (需要登录)
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册
Your Site Analytics