本文整理汇总了PHP中yii\web\Session::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::get方法的具体用法?PHP Session::get怎么用?PHP Session::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\web\Session
的用法示例。
在下文中一共展示了Session::get方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
public function delete()
{
if (empty($this->session->get('game'))) {
return false;
}
$this->session->offsetUnset('game');
return true;
}
示例2: loadMember
/**
* loadMember
*
* @return bool
*/
protected function loadMember()
{
// See if session has member
if ($this->session->get('memberId') && $this->session->get('memberKey')) {
// Try to load from Session
$memberId = (int) $this->session->get('memberId');
$memberKey = $this->session->get('memberKey');
$member = Member::findOne($memberId);
if ($member && $member->validateMemberKey($memberKey) && $member->isActive) {
// OK
$this->member = $member;
return true;
}
}
// See if we need to load from Cookie
if (isset($_COOKIE['k'])) {
$cookieKey = $_COOKIE['k'];
$member = Member::loadFromCookieKey($cookieKey);
if ($member && $member->isActive) {
$this->member = $member;
return true;
}
}
return false;
}
示例3: ip
/**
* @param string|null $ip
* @return Result
*/
public function ip($ip = null)
{
if ($ip === null) {
$ip = Yii::$app->request->getUserIP();
}
if (!array_key_exists($ip, $this->result)) {
$key = self::className() . ':' . $ip;
if ($this->session->offsetExists($key)) {
$this->result[$ip] = $this->session->get($key);
} else {
$result = $this->reader->get($ip);
$this->result[$ip] = new Result($result);
$this->session->set($key, $this->result[$ip]);
}
}
return $this->result[$ip];
}
示例4: findIdentity
/**
* @inheritdoc
*/
public static function findIdentity($id)
{
$session = new Session();
$model = $session->get($id . '_' . __CLASS__);
if ($model) {
return unserialize($model);
}
return null;
}
示例5: Add
public function Add($id)
{
$session = new Session();
$session->open();
$cart = $session->get('cart', []);
if (empty($cart[$id])) {
$cart[$id] = 1;
} else {
$cart[$id]++;
}
}
示例6: actionChangePassword
/**
* [actionChangePassword Ubah password jika change password date null]
* @return url
*/
public function actionChangePassword()
{
// $this->layout='login';
$model = new LoginForm(['scenario' => 'changePassword']);
$session = new Session();
$username = $session->get('user_id');
if ($model->load(Yii::$app->request->post()) && $model->updatePassword()) {
$user = User::find()->where(['username' => $model->username])->one();
$user->setPassword($model->new_password);
$user->change_pass_date = date('Y-m-d H:i:s');
$user->generateAuthKey();
if ($user->save()) {
return $this->goHome();
}
} else {
Yii::$app->user->logout();
return $this->render('change-password', ['model' => $model, 'username' => $username]);
}
}
示例7: actionIndex
public function actionIndex()
{
$mregional = new Regional();
$mcustomer = new Customer();
$session = new Session();
$company = $session->get('company');
$facebook = Facebook::find()->asArray()->count();
$twitter = Twitter::find()->asArray()->count();
$blog = Blog::find()->asArray()->count();
$instagram = Instagram::find()->asArray()->count();
$customer = Customer::find()->asArray()->count();
$customer_countall = $mcustomer->find()->limit(7)->count();
$regional = $mregional->find()->limit(7)->all();
$speedo = "";
foreach ($regional as $key => $rows) {
$customer_count = $mcustomer->find()->where(['FIELD7' => $rows->FIELD1])->andWhere(['FIELD9' => $company])->limit(7)->count();
$no = $key + 1;
$percentage = $customer_count / $customer_countall * 100;
$agree = number_format($percentage, 0, '.', '.');
$speedo .= "<div class='wrapp-spedo'>\n <div id='speedo" . $no . "'>\n " . $agree . "\n </div>\n <h4 align='center'>REGIONAL " . $no . "</h4>\n </div>";
}
return $this->render('index', ['speedo' => $speedo, 'facebook' => $facebook, 'twitter' => $twitter, 'blog' => $blog, 'instagram' => $instagram, 'customer' => $customer]);
}
示例8: number_format
?>
</div>
<?php
}
?>
<div>
<h4 style="color: #407A52">
<i class="glyphicon glyphicon-usd"></i>
<?php
echo number_format($product->price, 2);
?>
</h4>
</div>
<div>
<?php
if (!empty($session->get('member_id'))) {
?>
<a href="index.php?r=frontend/addtocart" class="btn btn-success">
<i class="glyphicon glyphicon-plus"></i>
Add to Cart
</a>
<?php
}
?>
</div>
</div>
</div>
<!-- image of product -->
<div class="col-md-12" style="margin-top: 50px">
<div class="row">
示例9: Session
$this->title = 'Call Histories';
$this->params['breadcrumbs'][] = $this->title;
$gridColumns = ['Al', 'Anumber', 'start_time', 'end_time', 'duration', 'Bl', 'Bnumber', 'Zon', 'Trunk1', 'Trunk2', 'setup_time', ['class' => 'kartik\\grid\\ActionColumn']];
$columnExport = ['Al', 'Anumber', 'start_time', 'end_time', 'duration', 'Bl', 'Bnumber', 'Zon', 'Trunk1', 'Trunk2', 'setup_time'];
?>
<div class="call-history-index">
<div class="row">
<div class="col-md-11 col-xs-10">
<button type="button" class="btn btn-primary-budi" id="search-data">Advanced Search</button>
</div>
<div class="col-md-1">
<?php
$session = new Session();
?>
<?php
echo ExportMenu::widget(['dataProvider' => $session->get('dataProviderCallHistory'), 'columns' => $columnExport, 'showConfirmAlert' => false, 'showColumnSelector' => false, 'target' => ExportMenu::TARGET_SELF, 'exportConfig' => [ExportMenu::FORMAT_HTML => false, ExportMenu::FORMAT_PDF => false, ExportMenu::FORMAT_TEXT => false, ExportMenu::FORMAT_EXCEL => false, ExportMenu::FORMAT_EXCEL_X => false, ExportMenu::FORMAT_CSV => ['label' => 'Export CSV']], 'filename' => date('Y-m-d')]);
?>
</div>
</div>
<br>
<?php
Pjax::begin(['id' => 'call-history-grid']);
?>
<?php
echo GridView::widget(['dataProvider' => $dataProvider, 'hover' => true, 'filterSelector' => "input[name='" . $dataProvider->getPagination()->pageSizeParam . "'],input[name='" . $dataProvider->getPagination()->pageParam . "']", 'panel' => ['type' => GridView::TYPE_PRIMARY, 'heading' => '<h4>' . Html::encode($this->title) . '</h4>'], 'columns' => ['start_time', 'end_time', 'Al', 'Anumber', 'duration', 'Bl', 'Bnumber', 'Zon', 'Trunk1', 'Trunk2', 'setup_time']]);
?>
<?php
Pjax::end();
?>
示例10:
" width="40px" />
<?php
}
?>
<!-- web title -->
<?php
echo $company->web_title;
?>
</h4>
</div>
<div class="pull-right">
<!-- form login -->
<div style="margin-top: 10px">
<?php
if (empty($session->get('member_id'))) {
?>
<?php
$f = ActiveForm::begin(['action' => 'index.php?r=frontend/login', 'options' => ['class' => 'form-inline']]);
?>
<input type="text" class="form-control" name="username" style="width: 130px" placeholder="Username" />
<input type="password" class="form-control" name="password" style="width: 130px" placeholder="Password" />
<input type="submit" class="btn btn-primary btn-sm" value="Login" />
<a class="btn btn-warning btn-sm" href="index.php?r=frontend/register">
Register
<i class="glyphicon glyphicon-chevron-right"></i>
</a>
<?php
ActiveForm::end();
?>
<?php
示例11: actionHistory
public function actionHistory()
{
$session = new Session();
$session->open();
$billOrders = BillOrder::find()->where(['member_id' => $session->get('member_id')])->orderBy('id DESC')->all();
return $this->render('//Frontend/History', ['billOrders' => $billOrders, 'n' => 1, 'sumQty' => 0, 'sumPrice' => 0]);
}
示例12: Session
<?php
use yii\web\Session;
$session = new Session();
$session->open();
?>
<div class="panel">
<div class="panel-body">
<h4>Login Result.</h4>
<hr>
<div class="alert alert-success">
<h3>
<i class="glyphicon glyphicon-ok"></i>
Welcome
<?php
echo $session->get('member_name');
?>
</h3>
</div>
</div>
</div>
示例13: getExpectedStep
/**
* Returns the first unprocessed step (i.e. step data not saved in Session).
* @return string|null The first unprocessed step; null if all steps have been processed
*/
protected function getExpectedStep()
{
$storedSteps = array_keys($this->_session->get($this->_stepsKey, []));
foreach ($this->_steps as $step) {
if (!in_array($step, $storedSteps)) {
return $step;
}
}
return null;
}