请帮帮我,我想用PHP,MySql实现
假设我们有一个句子
“语法单位,在语法上独立,并且具有表达的主题”
我想检索与上述句子中任何连续五个单词匹配的所有数据,即
“语法单位是”或
“句法上的语法单位”或者
“语法独立的单位”或等等
我们可以使用正则表达式匹配或任何简单的解决方案吗? 期待你的光临 感谢
答案 0 :(得分:0)
你可以把这些条件放在数据库级别,在mysql中你可以这样做:
curl -v -o delete.txt --trace-time https://asd.com/
06:43:46.708926 * Rebuilt URL to: https://asd.com/
06:43:46.709023 * Hostname was NOT found in DNS cache
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 006:43:47.218368 * Trying 0.0.0.0...
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 006:43:47.236048 * Connected to asd.com (0.0.0.0) port 443 (#0)06:43:47.237853 * successfully set certificate verify locations:
06:43:47.237898 * CAfile: none
CApath: /etc/ssl/certs
06:43:47.238039 * SSLv3, TLS handshake, Client hello (1):
06:43:47.238061 } [data not shown]
0 0 0 0 0 0 0 0 --:--:-- 0:00:57 --:--:-- 006:44:44.575998 * Unknown SSL protocol error in connection to asd.com:443
答案 1 :(得分:0)
如果你想用PHP做,你可以尝试这样的事情:
$sentence = "A grammatical unit that is syntactically independent and has a subject that is expressed";
$arr = explode(" ", $sentence);
var_dump($arr);
for ($i = 0; $i < (count($arr) - 5); $i++) {
$newSentence = $arr[$i] + " " + $arr[$i + 1] + " " + $arr[$i + 2] + " " + $arr[$i + 3] + " " + $arr[$i + 4];
//do database inset here
}