function search_data($search_dt) { $data = $this->get_all('sanpham'); $data_search = array(); $search = '/' . strU($search_dt) . '/'; foreach ($data as $value) { if (preg_match($search, strU($value['masp'])) == TRUE || preg_match($search, strU($value['kichthuoc'])) == TRUE || preg_match($search, strU($value['dongia'])) == TRUE || preg_match($search, strU($value['tensp'])) == TRUE || preg_match($search, strU($value['macl'])) == TRUE || preg_match($search, strU($value['mancc'])) == TRUE || preg_match($search, strU($value['maloai'])) == TRUE) { $data_search[] = $value; } } return $data_search; }
/** * Chuyển về chuỗi alias * @param string * @return string */ function alias($str) { $str = strU($str); $str = strtolower($str); $str = str_replace(' ', '-', $str); return $str; }