Skip to content

Commit

Permalink
fix 32bit converto 32 num
Browse files Browse the repository at this point in the history
  • Loading branch information
slince committed Jun 1, 2017
1 parent 1f4e24f commit 43a76c7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
9 changes: 6 additions & 3 deletions examples/get_friends.php
Expand Up @@ -15,20 +15,23 @@
//1、获取所有好友
$friends = $smartQQ->getFriends();


//2、从好友中筛选出指定好友,
/**
* 注意QQ号需要单独发起请求查询QQ号,故如果需要按照QQ号筛选,需要做好心里准备
* smartqq会多次发起请求
*/
$friend = $friends->firstByAttribute('nick', '清延°');


//3、获取好友的详细信息
$profile = $smartQQ->getFriendDetail($friend);

//4、获取好友的真实QQ号
$qq = $smartQQ->getFriendQQ($friend);
//4、获取好友的真实QQ号(此接口目前已经被腾讯封禁)
//$qq = $smartQQ->getFriendQQ($friend);

//3、输出结果
printPrettyScreen($friends->toArray());
printR($friend);
printR($profile);
printR($qq);
//printR($qq);
5 changes: 4 additions & 1 deletion src/Utils.php
Expand Up @@ -61,7 +61,10 @@ public static function hash33($string)
$e = 0;
$n = strlen($string);
for ($i = 0; $n > $i; ++$i) {
$e = static::toUint32val($e);
//64位php才进行32位转换
if (PHP_INT_MAX > 2147483647) {
$e = static::toUint32val($e);
}
$e += ($e << 5) + static::charCodeAt($string, $i);
}
return 2147483647 & $e;
Expand Down

0 comments on commit 43a76c7

Please sign in to comment.