yii 未找到类“移动的_Detect”

ioekq8ef  于 2022-11-09  发布在  其他
关注(0)|答案(1)|浏览(133)

首先,我的代码工作正常,然后我完成另一个任务,我推,然后进行拉,并解决冲突后,我拦截了这个错误error messsage
这是我的composer.json代码

"minimum-stability": "stable",
"require": {
    "php": ">=7.3.0",
    "ext-json": "*",
    "yiisoft/yii2": "~2.0.23",
    "yiisoft/yii2-bootstrap4": "~2.0.6",
    "yiisoft/yii2-swiftmailer": "~2.0.0 || ~2.1.0",
    "yiisoft/yii2-debug": "^2.1",
    "yiisoft/yii2-redis": "^2.0",
    "yiisoft/yii2-imagine": "^2.2",
    "bigbluebutton/bigbluebutton-api-php": "~2.0.0",
    "mobiledetect/mobiledetectlib": "^2.8"
},

这是我的控制器

use Mobile_Detect;

trait WithMeetingTrait

{

protected function getMeetingId($model)
{
    /**
     * @var $model Seminar
     */
    return mb_strtoupper(substr($model::className(), 0, 3)) . '-' . $model->id;
}

protected function allowedToCreate()
{
    // TRUE if super admin or $this->userIsModelOwner();
}

/**
 * @param $link
 * @return mixed
 * @throws InvalidConfigException
 * @throws NotInstantiableException
 */
public function actionStart($link)
{
    /**
     * @var $model Seminar
     */
    $model = $this->findModelByColumn('link', $link);

    // TODO only super admin or the room teacher can create the room if allowedToCreate()
    $meeting  = $this->getWebConference();
    $response = $meeting->create(
        $this->getMeetingId($model),
        $model->name,
        Url::to(['seminar/join', 'link' => $model->link], true),
        ['ownerType' => $model::className(), 'ownerId' => $model->id]
    );

    $detect = new Mobile_Detect;
    $settings = Settings::find()->where(['setting_name' => Settings::DEVICE_TYPE])->one();
    if ($settings->value === 'Yes') {
        if ($detect->isMobile()) {
            $icon = ' ⬛';
        } elseif ($detect->isTablet()) {
            $icon = ' 📱';
        } else {
            $icon = ' 💻';
        }
    } else {
        $icon = '';
    }

我使用packagist mobile detect提供的此服务
我需要帮助

lo8azlld

lo8azlld1#

检查移动的检测脚本的命名空间。

use Detection\MobileDetect;
$mobileDetect = new MobileDetect();

相关问题