我在使用trim()
函数时出现了问题,代码如下:
$handle = @fopen("55.txt", "r");
if ($handle) {
while (($buffer = fgets($handle, 4096)) !== false) {
$d = explode(" ", $buffer);
foreach($d as $val) {
echo '<br>'.trim($val,'.'); //why not work
}
}
if (!feof($handle)) {
echo "Error: unexpected fgets() fail\n";
}
fclose($handle);
}
trim()
方法不能去除 '.'
。
trim()
去除末尾句号后面的空白字符吗?请展示55.txt
文件的样本内容。 - Michael Berkowski