$sub= '我有5斤大米,6斤白面,售賣100元';
我想提取"有5斤大米"、"賣100元",用preg_match_all( '/.?\d+.?/', $sub, $match)出現亂碼
改成preg_match_all( '/.?\d+.?/u', $sub, $match)后正常,
這里的小寫字母u是修飾符,表示把字符當UTF-8處理,
官方檔案:https://www.php.net/manual/en/reference.pcre.pattern.modifiers.php

轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/63414.html
標籤:PHP
