MainController.php 729 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace mobile\controllers;
  3. use biz\user\services\UserService;
  4. use common\components\token;
  5. use Yii;
  6. use yii\db\Exception;
  7. use yii\web\Controller;
  8. class MainController extends PublicController
  9. {
  10. public $enableCsrfValidation = false;
  11. public function actionIndex()
  12. {
  13. $host = Yii::$app->request->getHostInfo();
  14. $fullUrl = Yii::$app->request->url;
  15. $token = '';
  16. if(strpos($fullUrl, 'token')){
  17. $parse = parse_url($fullUrl);
  18. if (isset($parse['query'])) {
  19. parse_str($parse['query'], $queryArray);
  20. if (isset($queryArray['token']) && !empty($queryArray['token'])) {
  21. $token = $queryArray['token'];
  22. }
  23. }
  24. }
  25. return $this->renderPartial('index', ['host' => $host, 'token' => $token]);
  26. }
  27. }