コード例 #1
0
ファイル: Albom.php プロジェクト: kansey/yii2albom
 /**
  *  Get mode User with tocken
  * 
  * @return mixed
 */
 public static function getUser()
 {
     $model = new Albom();
     $tocken = $model->getTockenUser();
     $user = User::findOne(['tocken' => $tocken]);
     return ['login' => $user->login, 'email' => $user->email];
 }
コード例 #2
0
ファイル: index.php プロジェクト: kansey/yii2albom
<?php

/* @var $this yii\web\View */
use app\models\User;
use app\models\Albom;
use yii\helpers\ArrayHelper;
use yii\widgets\DetailView;
$this->registerCssFile('css/bootstrap.css');
$this->registerCssFile('css/bootstrap-responsive.css');
$this->title = 'My Yii Application';
$user = Albom::getUser();
?>
<div class="site-index">
    <div class="jumbotron">
     <h1>Simple Gallery</h1>
     <p class="lead">A simple application created with the framework Yii2. Additional features will be added later.</p>
    </div>

    <div class="body-content">
        <div class="row">
            <div class="col-lg-4">
                <h2>Profile User</h2>
                <div class="row-fluid">
                <div class="span8">
                <h6>Username: <?php 
echo $user['login'];
?>
</h3>
                <h6>Email: <?php 
echo $user['email'];
?>