mor*_*ant 11 php mysql full-text-search
我知道如何正确地更改MySQL ft_min_word_len配置变量,但我在PHP和MySQL文档中似乎无法轻易找到(也许我没有使用正确的搜索术语)是否有一种方法以编程方式获取ft_min_word_len使用的值PHP.如果查询包含的搜索条件短于ft_min_word_len,则我的搜索引擎应该抛出错误,如果它可以自动执行而不记得设置变量,那么它将会有所帮助.
Nic*_*ssu 23
您可以使用show variables并从php中检索其值.
show variables like 'ft_min%'
Run Code Online (Sandbox Code Playgroud)
来自php
$query = mysql_query("show variables like 'ft_min%'") or die(trigger_error());
$num = mysql_fetch_row($query);
echo $num[1];
Run Code Online (Sandbox Code Playgroud)
只是为了您的信息,您甚至可以从information_schema获得此值
select variable_value from information_schema.global_variables
where variable_name like 'ft_min%'
Run Code Online (Sandbox Code Playgroud)