Php 类别';移动检测&x27;找不到
首先,我的代码工作正常 然后,我完成另一项任务,我推 然后拉一把,解决冲突 之后我截获了这个错误 这是我的composer.json代码Php 类别';移动检测&x27;找不到,php,yii,yii2,composer-php,yii2-advanced-app,Php,Yii,Yii2,Composer Php,Yii2 Advanced App,首先,我的代码工作正常 然后,我完成另一项任务,我推 然后拉一把,解决冲突 之后我截获了这个错误 这是我的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-s
"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 = ' Check the namespace of the mobile detect script.
I can include the script with
use Detection\MobileDetect;
$mobileDetect = new MobileDetect();
使用手机进行检测;
特征与会面特征
{
受保护的函数getMeetingId($model)
{
/**
*@var$模型研讨会
*/
返回mb_strtoupper(substr($model::className(),0,3)).-'.$model->id;
}
允许创建()的受保护函数
{
//如果超级管理员或$this->userIsModelOwner(),则为TRUE;
}
/**
*@param$link
*@返回混合
*@引发InvalidConfigException
*@throws-NotInstantiableException
*/
公共功能actionStart($link)
{
/**
*@var$模型研讨会
*/
$model=$this->findModelByColumn('link',$link);
//TODO如果允许创建()的话,只有超级管理员或房间老师才能创建房间
$meeting=$this->getWebConference();
$response=$meeting->create(
$this->getMeetingId($model),
$model->name,
Url::to(['sensorry/join','link'=>$model->link],true),
['ownerType'=>$model::className(),'ownerId'=>$model->id]
);
$detect=新手机检测;
$settings=settings::find()->其中(['setting\u name'=>settings::DEVICE\u TYPE])->one();
如果($settings->value==='Yes'){
如果($detect->isMobile()){
$icon='1⬛';
}elseif($detect->isTablet()){
$icon='检查移动检测脚本的命名空间。
我可以将脚本包括在内
您的供应商目录是否可能添加到.gitignore?mobiledetect是否在您的供应商目录中?那么这可能是您的问题,再次运行composer来安装它。问题仍然是composer当时安装的相同ID或composer update?之后,它应该安装在您的供应商目录中。我刚刚尝试了新的Yii2安装-它肯定适用于使用移动检测
-当找不到该类时,它必须是install或Composer autoloader出现问题-您可以检查此文件是否存在:供应商/mobiledetect/mobiledeteclib/Mobile\u Detect.php
?