本文整理汇总了PHP中Session::remove方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::remove方法的具体用法?PHP Session::remove怎么用?PHP Session::remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Session
的用法示例。
在下文中一共展示了Session::remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testRemove
/**
* @covers $this->object->remove
* @todo Implement testRemove().
*/
public function testRemove()
{
session_start();
$_SESSION['test'] = 'TEST';
$this->object->remove('test');
$this->assertEquals(false, isset($_SESSION['test']));
}
示例2: home
/**
* Add apartment page
* @return \Illuminate\View\View
*/
public function home()
{
$apartment = new ListApartment();
//Hard code
$apartment->username = Auth::user()->username;
// Get all district
$district = ListDistrict::lists('name_district', 'id_district');
// Get all province
$province = ListProvice::lists('name_province', 'id_province');
// Get all project
$projects = ListProject::lists('name', 'ID');
//Get project
$project_id = Input::get('project');
$apartment->project = $project_id;
// Get all furniture
$furnitures = Furniture::lists('name', 'ID');
// Get all management company
$directions = Direction::lists('name', 'ID');
// Get all floor material
$floor_materials = FloorMaterial::lists('name', 'ID');
// Clear Session
for ($i = -2; $i < 8; $i++) {
if (Session::has("image[{$i}]")) {
Session::remove("image[{$i}]");
}
}
return View::make('pages.apartment', compact('apartment', 'district', 'province', 'projects', 'project_id', 'furnitures', 'directions', 'floor_materials'));
}
示例3: manager
public function manager()
{
if (Request::segment(2) == 'search') {
$input = Session::get('search') && !Input::get('search_category') ? Session::get('search') : Input::only(array('search_category', 'search_keyword'));
switch ($input['search_category']) {
case '0':
return Redirect::to('managers');
break;
case 'owner':
$users = User::where('status', 3)->whereHas('domain', function ($q) {
$q->whereHas('user', function ($q) {
$q->where('username', 'like', '%' . Input::get('search_keyword') . '%');
});
})->get();
break;
case 'name':
$users = User::where('status', 3)->whereHas('profile', function ($q) {
$q->where(function ($q) {
$q->where('first_name', 'like', '%' . Input::get('search_keyword') . '%');
$q->orWhere('last_name', 'like', '%' . Input::get('search_keyword') . '%');
});
})->get();
break;
default:
$users = User::where('status', 3)->where($input['search_category'], 'LIKE', '%' . $input['search_keyword'] . '%')->get();
break;
}
Session::set('search', $input);
} else {
Session::remove('search');
$input = array('search_category' => '', 'search_keyword' => '');
$users = User::where('status', 3)->get();
}
return View::make('user_management.index')->with('users', $users)->with('selected', $input);
}
示例4: getIndex
/**
* Display a listing of the resource.
*
* @return Response
*/
public function getIndex()
{
if (Request::segment(2) == 'search') {
$input = Session::get('search') && !Input::get('search_category') ? Session::get('search') : Input::only(array('search_category', 'search_keyword'));
switch ($input['search_category']) {
case '0':
return Redirect::to('gateway');
break;
case 'owner':
$gateways = Gateway::whereHas('user', function ($q) {
$q->where('username', 'LIKE', '%' . Input::get('search_keyword') . '%');
})->get();
break;
default:
if (Auth::user()->status == 2) {
$gateways = Gateway::where($input['search_category'], 'LIKE', '%' . $input['search_keyword'] . '%')->get();
} else {
$gateways = Gateway::where('user_id', Auth::user()->id)->where($input['search_category'], 'LIKE', '%' . $input['search_keyword'] . '%')->get();
}
break;
}
Session::set('search', $input);
} else {
Session::remove('search');
$input = array('search_category' => '', 'search_keyword' => '');
$gateways = Auth::user()->status == 2 ? Gateway::all() : Gateway::where('user_id', Auth::user()->id)->get();
}
return View::make('gateway.index')->with('gateways', $gateways)->with('selected', $input);
}
示例5: logoutAction
public function logoutAction($key = 'user')
{
Session::remove($key);
Session::destroy();
Session::setFlash(__t('you_logout'));
$this->redirect("/");
}
示例6: tokenValidate
/**
* tokenチェック
*/
protected function tokenValidate($name = 'token')
{
$request = Request::getInstance();
$value = $request->get($name, '');
$value = mb_convert_kana($value, 'n');
return Session::remove($name) == $value ? null : __('Token authentication is invalid');
}
示例7: LA_Session_Clear
function LA_Session_Clear($key)
{
// clear persisted value for the given string key
if (\Session::has($key)) {
\Session::remove($key);
}
}
示例8: remove
function remove($key = null) {
if ($key == null) {
$key = get_class($this);
} else {
$key = get_class($this).".$key";
}
Session::remove(ACTION_SCOPE, $key);
}
示例9: verify
public static function verify($key = null, $debug = false)
{
global $global;
$result = Session::get('_token.' . $global['name']) === ($key == null ? Form::get('token', 'no') : $key);
if (!$debug) {
Session::remove('_token.' . $global['name']);
}
return $result;
}
示例10: get
public static function get($key)
{
$prefixkey = self::$prefix . $key;
if (Session::exists($prefixkey)) {
$value = Session::get($prefixkey);
Session::remove($prefixkey);
return '<div class="alert alert-' . $key . '">' . $value . '</div>';
}
}
示例11: _validation_error
protected function _validation_error($obj)
{
$validationErrors = is_subclass_of($obj, 'LaravelBook\\Ardent\\Ardent') ? $obj->validationErrors : $obj;
if (Request::ajax()) {
return Response::json($validationErrors, 400);
}
Session::remove('_old_input');
return Redirect::back()->withErrors($validationErrors)->with('notification:danger', $this->validation_error_message);
}
示例12: tryLogout
public static function tryLogout()
{
if (Session::has("user")) {
Session::remove("user");
return true;
} else {
return false;
}
}
示例13: authenticate
public function authenticate()
{
//@todo sanitize post input
$post = $this->post();
$this->__ldap_connect();
if (empty($post['uName']) || empty($post['uPassword'])) {
throw new Exception(t('Please provide both username and password.'));
}
$domain = trim(Config::get('auth.ldap.ldapdomain'));
$uName = $post['uName'];
if (strlen($domain)) {
$ldapLoginuName = Config::get('auth.ldap.ldapdomain') . '\\' . $uName;
}
$uPassword = $post['uPassword'];
if (!@ldap_bind($this->connection, $ldapLoginuName, $uPassword)) {
throw new \Exception(t('Invalid username or password.'));
} else {
\Session::remove('accessEntities');
$uID = $this->getUserByLdapUser($uName);
if ($uID) {
// ldap user has been bound to a c5 user
$ui = UserInfo::getByID($uID);
}
if (!is_object($ui) || !$ui instanceof UserInfo || $ui->isError()) {
// user needs to be created
$user = $this->createUser($uName, $uName . "@" . $domain . '.us');
// @TODO email is a total hack right now - fix it.
} else {
$user = \User::loginByUserID($ui->getUserID());
}
if (is_object($user) && $user->isError()) {
switch ($user->getError()) {
case USER_SESSION_EXPIRED:
throw new \Exception(t('Your session has expired. Please sign in again.'));
break;
case USER_NON_VALIDATED:
throw new \Exception(t('This account has not yet been validated. Please check the email associated with this account and follow the link it contains.'));
break;
case USER_INVALID:
if (Config::get('concrete.user.registration.email_registration')) {
throw new \Exception(t('Invalid email address or password.'));
} else {
throw new \Exception(t('Invalid username or password.'));
}
break;
case USER_INACTIVE:
throw new \Exception(t('This user is inactive. Please contact the helpdesk regarding this account.'));
break;
}
}
}
if ($post['uMaintainLogin']) {
$user->setAuthTypeCookie('ldap');
}
$this->completeAuthentication($user);
}
示例14: isValid
public function isValid()
{
$validator = Validator::make($this->attributesToArray(), $this->rules);
if ($validator->fails()) {
Session::remove('messages');
foreach ($validator->getMessageBag()->getMessages() as $message) {
Session::push('messages', $message[0]);
}
// debug(Session::get('messages')); exit;
return false;
}
return true;
}
示例15: saveStory
/**
* This will save the access story to the database
*/
public function saveStory()
{
// set the end time
$this->getSessionManager()->setEndTime();
// calculate the memory usage
$this->getSessionManager()->setMemoryUsage();
// get the collected data
$aData = $this->getSessionManager()->getCollectedData();
$aData = array_merge($aData, ['response_time' => $this->getSessionManager()->getTimeTaken(), 'memory_usage' => $this->getSessionManager()->getMemoryUsage()]);
// save the access history now
AccessStoryModel::create($aData);
// remove the session, so that it would always be unique across each request
\Session::remove(Reader::getSessionKeyName());
}