PHP code example of marcovtwout / yii-detectmobilebrowser

1. Go to this page and download the library: Download marcovtwout/yii-detectmobilebrowser library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

marcovtwout / yii-detectmobilebrowser example snippets


'components' => array(
   'detectMobileBrowser' => array(
       'class' => 'ext.yii-detectmobilebrowser.XDetectMobileBrowser',
       //'secure' => true,
       //'httpOnly' => true,
    ),
),

if (Yii::app()->detectMobileBrowser->showMobile) {
    // do something
}

public function actionShowMobile() {
    Yii::app()->detectMobileBrowser->showMobile = true;
    $this->redirect(array('/site/index'));
}