0
0

common.php 407 B

123456789101112131415161718192021
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: my
  5. * Date: 2021/7/6
  6. * Time: 9:15
  7. */
  8. use think\facade\View;
  9. /**
  10. * 检测用户是否登录
  11. * @return integer 0-未登录,大于0-当前登录用户ID
  12. */
  13. function is_login(){
  14. $user = session('user_auth');
  15. if (empty($user)) {
  16. return 0;
  17. } else {
  18. return session('user_auth_sign') == data_auth_sign($user) ? $user['id'] : 0;
  19. }
  20. }