UserInfoMo.php 1.2 KB

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