0
我编写了这个函数来检索基于STRPOS的stats中记录的网站链接的首页,但是Medoo发现了一个错误。如何在Medoo查询中使用strpos
function getSiteAuthor($string) {
if ($string) {
$result = db::query("SELECT id, http FROM users WHERE (strpos(http, '$string') != false) ");
foreach ($result as $row) {
return $row['id'];
}
}
}
http可能为 “http://example.com” 和$字符串可能是 “http://example.com/somePage/”。所以我要寻找其中http被发现包含在$字符串
的错误是“在表中找不到strpos”。
可以这样使用strpos来完成,还是应该使用LIKE如果是的话,如何代码。