/** * 事前処理関数をオーバーライド * * ハイフンと類似する文字をハイフンに変換 * 文字列をすべて半角に変換 * 空白は連続を除去する */ protected static function normalize($str = '') { $str = mb_convert_kana($str, 'anhks'); $str = self::unificate_hyphen($str, '-'); $str = parent::normalize($str); return $str; }
/** * 事前処理関数をオーバーライド * * 空白以外の文字列を全角に変換 * 空白は連続を除去して半角に変換 */ protected static function normalize($str = '') { $str = mb_convert_kana($str, 'AKV'); $str = mb_convert_kana($str, 's'); $str = parent::normalize($str); return $str; }
<?php require 'Fuzzy.php'; $helper = new Db(); $fuzzy = new Fuzzy(3, 1.8); // var_dump($_GET); if (isset($_GET['req'])) { header("Access-Control-Allow-Origin: *"); // header("Content-Type: application/json; charset=UTF-8"); if ($_GET['req'] == 'speed') { echo json_encode($helper->getSpeedSets()); } else { if ($_GET['req'] == 'brake') { echo json_encode($helper->getBrakeSets()); } else { if ($_GET['req'] == 'distance') { echo json_encode($helper->getDistanceSets()); } else { if ($_GET['req'] == 'throttle') { echo '{"records": ' . json_encode($helper->getThrottleSets()); } } } } } else { if (isset($_GET['data'])) { header("Access-Control-Allow-Origin: *"); if ($_GET['data'] == 'speedSet') { return $fuzzy->getData('speedSet'); } else { if ($_GET['data'] == 'distanceSet') {