I know how to properly change the MySQL ft_min_word_len
configuration variable, but what I can't seem to easily find in the PHP & MySQL documentation (maybe I'm not using correct search terms) is if there's a way to programatically get the value of ft_min_word_len
using PHP. My search engine should throw an error if the query contains search terms shorter than ft_min_word_len
and it'd be helpful if it could do it automatically without me remembering to set a variable.
我知道如何正确地更改MySQL ft_min_word_len配置变量,但是在PHP和MySQL文档(可能我没有使用正确的搜索术语)中,我似乎很难找到使用PHP编程获取ft_min_word_len值的方法。如果查询包含比ft_min_word_len更短的搜索词,我的搜索引擎应该会抛出一个错误,如果它可以自动执行,而不需要我记住设置一个变量,那将会很有帮助。
1 个解决方案
#1
22
You can use show variables and retrieve its value from php.
您可以使用show variables并从php中检索它的值。
show variables like 'ft_min%'
From php
从php
$query = mysql_query("show variables like 'ft_min%'") or die(trigger_error());
$num = mysql_fetch_row($query);
echo $num[1];
Just for your information you can get this value even from the information_schema
仅对于您的信息,您可以从information_schema中获取这个值
select variable_value from information_schema.global_variables
where variable_name like 'ft_min%'
#1
22
You can use show variables and retrieve its value from php.
您可以使用show variables并从php中检索它的值。
show variables like 'ft_min%'
From php
从php
$query = mysql_query("show variables like 'ft_min%'") or die(trigger_error());
$num = mysql_fetch_row($query);
echo $num[1];
Just for your information you can get this value even from the information_schema
仅对于您的信息,您可以从information_schema中获取这个值
select variable_value from information_schema.global_variables
where variable_name like 'ft_min%'