- 工信部備案號 滇ICP備05000110號-1
- 滇公安備案 滇53010302000111
- 增值電信業(yè)務經(jīng)營許可證 B1.B2-20181647、滇B1.B2-20190004
- 云南互聯(lián)網(wǎng)協(xié)會理事單位
- 安全聯(lián)盟認證網(wǎng)站身份V標記
- 域名注冊服務機構許可:滇D3-20230001
- 代理域名注冊服務機構:新網(wǎng)數(shù)碼
方法一,strip_tags()剝?nèi)プ址械?HTML 標簽:
1 2 3 4 | <?php echo strip_tags("Hello <b>world!</b>"); //運行結果:Hello world! ?> |
方法二,自定義函數(shù)去除
1 2 3 4 5 6 7 8 9 10 | function cutstr_html($string, $sublen){ $string = strip_tags($string); $string = preg_replace ('/\n/is', '', $string); $string = preg_replace ('/ | /is', '', $string); $string = preg_replace ('/ /is', '', $string); preg_match_all("/[\x01-\x7f]|[\xc2-\xdf][\x80-\xbf]|\xe0[\xa0-\xbf][\x80-\xbf]|[\xe1-\xef][\x80-\xbf][\x80-\xbf]|\xf0[\x90-\xbf][\x80-\xbf][\x80-\xbf]|[\xf1-\xf7][\x80-\xbf][\x80-\xbf][\x80-\xbf]/", $string, $t_string); if(count($t_string[0]) - 0 > $sublen) $string = join('', array_slice($t_string[0], 0, $sublen))."…"; else $string = join('', array_slice($t_string[0], 0, $sublen)); return $string; } |
售前咨詢
售后咨詢
備案咨詢
二維碼
TOP