使用阿里云低成本打造站内搜索引擎,之前发过一个,但是不完整,各位久等了,下面给的是一个截图。
一个在线演示 http://www.27tree.com/search/?q=html
这个就是真正的教程啦,刚刚写的,欢迎吐槽http://www.27tree.com/blog/2013-05-07/content_397.html ///api访问入口 define('apiroot', 'http://css.aliyun.com'); /// 请替换成您的用户编码 define('client_id', 6100098522958080); /// 请替换成您的密钥 define('client_secret', '2e58ba4e81e092e616a73fb63845c043'); $api = new cloudsearchapi(apiroot, client_id, client_secret); ///获取cloudsearch对象,假设索引已经创建,并且已经上传过文档。 $indexname = 'test_index_1'; $index = $api->getindex($indexname); try { $result = $index->search('q=云搜索'); } catch (exception $e) { exit($e->getmessage()); }
复制代码