UserInfoMo.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace loyalsoft;
  3. /**
  4. * 玩家信息 for Each User in Memcache
  5. * Ps.
  6. * @author gwang
  7. */
  8. class UserInfoMo {
  9. /**
  10. * 玩家游戏数据
  11. * @var Data_UserGame
  12. */
  13. public $game;
  14. /**
  15. * 获得用户的平台字符串
  16. * @return string
  17. */
  18. function getPlatStr() {
  19. switch (PLAT) {
  20. case 'web': # web版
  21. return 'qzone'; # only QQ空间
  22. case 'ios': # ios版
  23. return 'ios'; # only ios
  24. case 'and': # 安卓版/默认
  25. default :
  26. return substr(req()->uid, 0, strrpos(req()->uid, '-')); # 提取平台字符串
  27. //substr() 函数返回字符串的一部分 strrpos() 函数查找字符串在另一字符串中最后一次出现的位置。
  28. }
  29. }
  30. }