CSession.php 703 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /**
  3. * FecShop file.
  4. *
  5. * @link http://www.fecshop.com/
  6. * @copyright Copyright (c) 2016 FecShop Software LLC
  7. * @license http://www.fecshop.com/license/
  8. */
  9. namespace fec\helpers;
  10. use Yii;
  11. /**
  12. * @author Terry Zhao <2358269014@qq.com>
  13. * @since 1.0
  14. */
  15. class CSession
  16. {
  17. public static function getSessionM(){
  18. return Yii::$app->session;
  19. }
  20. # 1. 设置session
  21. public static function set($key,$value){
  22. return self::getSessionM()->set($key,$value);
  23. }
  24. # 2.得到session
  25. public static function get($key){
  26. return self::getSessionM()->get($key);
  27. }
  28. # 3.删除session
  29. public static function remove($key){
  30. return self::getSessionM()->remove($key);
  31. }
  32. }