(PHP 4, PHP 5, PHP 7, PHP 8)
chunk_split — 將字符串分割成小塊
$string, int $length = 76, string $separator = "\r\n"): string
使用此函數(shù)將字符串分割成小塊非常有用。例如將
base64_encode() 的輸出轉(zhuǎn)換成符合 RFC 2045 語義的字符串。它會在每
length 個字符后邊插入
separator。
string要分割的字符。
length分割的尺寸。
separator行尾序列符號。
返回分割后的字符。
示例 #1 chunk_split() 例子
<?php
// 使用 RFC 2045 語義格式化 $data
$new_string = chunk_split(base64_encode($data));
?>