2
我需要在控制器中检测移动条件。我在我的控制器中尝试了下面的代码。CakePHP 3:如何通过requestHandler检测控制器中的移动?
public function initialize()
{
parent::initialize();
$this->loadComponent('RequestHandler');
}
然后我写了下面的代码在指数法
if ($this->RequestHandler->is('mobile'))
{
//condition 1
}else {
//condition 2
}
在这里,我得到的错误
Error: Call to undefined method Cake\Controller\Component\RequestHandlerComponent::is()
如何移动的控制器检测?