(1).下载3.4.1版本
http://sphinxsearch.com/downloads/current/
(2).配置数据源和索引(超精简版本)
# # Minimal Sphinx configuration sample (clean, simple, functional) # source question_src { type = mysql sql_host = 187.99.929.99 sql_user = legaojiufeddssdg sql_pass = HjwmzCwALiGSDGfdf sql_db = learojiufengfdfd sql_port = 3306 # optional, default is 3306 sql_query = \ SELECT id,course_id,question_name \ FROM think_course_question #sql_attr_uint = id sql_attr_uint = course_id } index question { source = question_src path = D:/test/indexData/ ngram_len = 1 ngram_chars = U+3000..U+2FA1F } indexer { mem_limit = 128M } searchd { listen = 9312 listen = 9306:mysql41 log = D:/test/log/searchd.log query_log = D:/test/log/query.log read_timeout = 5 max_children = 30 pid_file = D:/test/searchd.pid seamless_rotate = 1 preopen_indexes = 1 unlink_old = 1 workers = threads # for RT to work binlog_path = D:/test/data/ }
(3).生成索引
indexer.exe -c ../etc/sphinx-min.conf question
(4).启动sphinx
./searchd.exe -c ../etc/sphinx-min.conf
(5).php启动查询
$cl = new SphinxClient (); $cl->SetServer($config['host'], $config['port']); $cl->SetConnectTimeout(1); $cl->SetLimits(0, $limit, 100); $res = $sphinxClient->Query($keyword, 'question');
1、允许单个域名访问指定某域名(http://client.runoob.com)跨域访问,则只需在http://server.runoob.com/server.php文件头部添加如下代码:header('Access-Control-Allow-Origin:http://client....
在项目中需要对图片进行裁剪,前端裁剪完成发送base64给后端,但是很意外的PHP获取到的数据和前端有点差距,之前我都是先加密,后端解密,但是这次依然不行。于是使用filter_input方法轻松解决。$base64 = filter_input(INPUT_POST...
<?php /* *算法学习自百度.只是学习和记录 */ header("Content-type:text/html;charset=utf-8"); //1.设置奖项,id是奖项id,name是中奖名称,v是中奖概率 $arr =&n...
在一个正式项目中操作人员提交239个产品信息进行保存,但是系统却提示没有提交239个产品,于是开启错误信息,显示如下:Warning: Unknown: Input variables exceeded 1000. To incr...
PHP不像net支持多继承,自身只支持单继承,为了解决这个问题,php出了Trait这个特性,减少单继承语言的限制。并且能让代码复用率更高。说白了就是一个对象的属性和方法扩展工具一样。例如:trait exts { public f...
将jsonp转为PHP数组和对象。/** * jsonp转数组|Jsonp转json * @param string $jsonp jsonp字符串 * @param bool $as...