awixe/session 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

awixe/session

Composer 安装命令:

composer require awixe/session

包简介

A session handler that acts as a wrapper

README 文档

README

StyleCI PHPVersion License

This module was designed as a wrapper so it could be injected into the pimple. It can also be used another way. For example, you can call the class directly and call any function statically to achieve the same result. It uses the native $_SESSION[] session variable array. We suggest you use this through pimple's dependency injector.

Install

There are two ways you can install this module. By using composer or by downloading directly, but if you download it directly and requires more steps you can view all the available downloads at https://github.com/Awixe/Session/releases so we recommend you use composer to make it simple.

With composer:

composer require awixe/session

Usage

If you are using the awixe module adapter than you can access it through the app function else if you are not use the awixe adapter then you have to declare a new object to use it.

Example #1:

<?php
// Require composer
require __DIR__ . '/vendor/autoload.php';

// Not required if the bootstrap file is required
session_start();

// Set a new session variable
app('session')->set('hello', 'world');

// Get a session variable
if (app('session')->get('hello')) {

    // Save result
    $output = [
        app('session')->get('hello')
    ];
}

// Delete a session variable
app('session')->del('hello');

// Print the result
print_r($output);

if (app('session')->get('hello')) {
    print(app('session')->get('hello'));
} else {
    var_dump(app('session')->get('hello'));
}

?>

Example #2:

<?php
// Require composer
require __DIR__ . '/vendor/autoload.php';
use Awixe\Module\Session\Handler;

// Not required if the bootstrap file is required
session_start();

// Declare a new object
$session = new Handler();

// Set a new session variable
$session->set('hello', 'world');

// Get a session variable
if ($session->get('hello')) {

    // Save result
    $output = [
        $session->get('hello')
    ];
}

// Delete a session variable
$session->del('hello');

// Print the result
print_r($output);

if ($session->get('hello')) {
    print($session->get('hello'));
} else {
    var_dump($session->get('hello'));
}

?>

Conclusion

统计信息

  • 总下载量: 18
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2017-10-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固