愚者樹屋

|
Home About Contact
|

series

3d軟體 (1) apache (1) css (4) eagle (1) godot (9) google-api (1) google翻譯 (1) html (6) hugo安裝 (7) javasciprt (1) javascript (14) jquery (3) mysql (9) notepad++ (1) php (33) python (1) unity (1) yt-dlp (1) 像素畫 (1) 免費軟體 (8) 壓力測試 (2) 弱點掃描修補 (1) 無障礙網站 (1) 社群網站 (1) 遊戲推薦 (5) 雜記 (1)

Tags

2d軟體 3d軟體 ai ai代理 apache css eagle godot google-api google翻譯 html hugo javasciprt javascript jquery mysql notepad++ php python tcpdf

php 切出每個中文字

post date - 2024/09/28
last update - 2024/09/28

最近用來製作模糊搜尋使用的方法,將每個中文字切出後尋找同時有出現這些中文字的資料。

方法

test中文abc會被切成Array ( [0] => test [1] => 中 [2] => 文 [3] => abc ) 存在$matches[0]中

preg_match_all('/([a-zA-Z0-9]+)|\p{Hangul}|\p{Hiragana}|\p{Han}|\p{Katakana}|(\p{Latin}+)|(\p{Cyrillic}+)/u', $str, $matches);

需要其他條件可以在這網站查詢
https://www.regular-expressions.info/unicode.html

參考資料

https://stackoverflow.com/questions/4113802/how-to-split-chinese-characters-in-php

Tags : php

series

3d軟體 (1) apache (1) css (4) eagle (1) godot (9) google-api (1) google翻譯 (1) html (6) hugo安裝 (7) javasciprt (1) javascript (14) jquery (3) mysql (9) notepad++ (1) php (33) python (1) unity (1) yt-dlp (1) 像素畫 (1) 免費軟體 (8) 壓力測試 (2) 弱點掃描修補 (1) 無障礙網站 (1) 社群網站 (1) 遊戲推薦 (5) 雜記 (1)

Tags

2d軟體 3d軟體 ai ai代理 apache css eagle godot google-api google翻譯 html hugo javasciprt javascript jquery mysql notepad++ php python tcpdf

Recent Posts

mysql時間戳轉換

2023/05/20

javascript字串型別轉換

2022/11/13

mysql 類型轉換

2024/01/28

php tcpdf 字形

2023/12/02

php pathinfo中文檔案名稱問題

2023/04/16

mastodon misskey pixiv plurk twitter 巴哈姆特

© 2022-2026 愚者樹屋