php mysql使用like模糊搜索json的数据

案例:数据库存储的json进行模糊搜索
$text = $data['text'];//leyangjun
//$text = preg_replace("/\s/", "", $text);
if (!empty($text)) {
    $json_text = str_replace("\\", "_", json_encode($text));
    $json_text = strval($json_text);
    $mSql .= " AND field_content like '%" . $json_text . "%' ";
}

猜你喜欢

转载自blog.csdn.net/leyangjun/article/details/80447402
今日推荐