header('Content-Type: text/html; charset=utf-8');
$file = file_get_contents('base64.txt');
$string = base64_encode($file);
echo $string;
$len = strlen($string);
for ($i=0; $i < $len; $i=$i+10) {
@$str .= '<p>'.substr($string, $i, 10).'</p>';
}
echo $str;
更简单的方法
echo chunk_split(base64_encode(file_get_contents('file.txt')),10,"\n");