(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');
<?php //对比$this和self /* * $this更倾向于对象本身 * */ class Par{ public  ...
前面的文章对于高并发下单商品导致商品库存为负值的问题请先阅读再阅读本篇文章一定对您有帮助,建议亲手测试较好。加上文件锁后的下单处理代码:【一】.阻塞模式:(如果其他进程已经加锁文件,当前进程会一直等其他进程解锁文件后继续执行)<?php //连接数据库 $con=mysqli_connect(...
(1).学习的目标:学会创建父子进程,并且能够区分当前进程是父还是子;了解父进程执行过程,子进程执行过程;能够用多进程执行任务(2).相关函数学习: (2.1)pcntl_fork()执行时: &nbs...
php7新增的特性(1).强制限制只能返回一种类型<?php class task { } //must return an integer function add(): int { &nb...
在项目下的composer配置文件修改(PaySdk是我这里一个支付sdk的目录,包含各种各样的支付sdk,这样写的意思让composer自动把PaySdk下的所有文件自动加载):"autoload": { &...
<?php //如果支持exec函数,可以使用的方式 exec('chcp 65001'); //如果exec函数因安全问题禁用,可以使用的方式 pclose(popen('chcp 65001', 'r'));...