SSDB 的 PHP 扩展客户端:phpssdb

WBOY
Release: 2016-06-23 13:34:38
Original
1105 people have browsed it

phpssdb 是用 C 实现的 SSDB 的 PHP 扩展客户端。

示例代码:

$ssdb_handle = new SSDB(); //可省略connect方法使用$ssdb_handle = new SSDB('127.0.0.1', 8888); $ssdb_handle->connect('127.0.0.1', 8888);$ssdb_handle->set('ssdb_version', '1.8.0');$ssdb_handle->get('ssdb_version');
Copy after login

本扩展支持的所有命令如果返回为NULL,代表可能的错误为命令参数错误、连接中断、服务器返回失败、客户端发送失败等

为兼容官方php代码实现的客户端,提供类别名SimpleSSDB 如 $ssdb_handle = new SimpleSSDB('127.0.0.1', 8888);

本扩展还提供了一个附近查询


//添加坐标$ssdb_handle->geo_set('geo_test', 'a', 31.197452, 121.515095);$ssdb_handle->geo_set('geo_test', 'b', 31.196456, 121.515778);$ssdb_handle->geo_set('geo_test', 'c', 31.197159, 121.518015);$ssdb_handle->geo_set('geo_test', 'd', 31.196282, 121.51563);$ssdb_handle->geo_set('geo_test', 'e', 31.203159, 121.518082);//查询b附近点距离不大于4000米,最大返回数量不超过10个$result = $ssdb_handle->geo_neighbour('geo_test', 'b', 4000, 10);print_r($result);
Copy after login

项目主页:http://www.open-open.com/lib/view/home/1431585396388

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template