第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

為什么中間加判斷語句的時候會輸出意想不到的輸出?

為什么中間加判斷語句的時候會輸出意想不到的輸出?

PHP
拉風的咖菲貓 2023-03-20 17:13:00
test1.txt文件內(nèi)容如下:this is my first day come in island.this is my first day come in island.this is my first day come in island.this is my first day come in island.我的PHP文件——filesystem.php文件內(nèi)容如下:$file = fopen("test1.txt","r");echo "<br>";while(!feof($file)){ echo fgetc($file); if(fgetc($file)==""){ echo "<br>"; }}fclose($file);在瀏覽器的輸出如下:ti sm is a oei sad ti sm is a oei sad ti sm is a oei sad ti sm is a oei sad 請問這是什么情況?
查看完整描述

1 回答

?
忽然笑

TA貢獻1806條經(jīng)驗 獲得超5個贊

PHP code?

$root = $_SERVER['DOCUMENT_ROOT'];
$file = fopen("$root/php_02/123.txt", "rb");
while(!feof($file)){
$char = fgetc($file);
if(!feof($file)):
echo $char == '\n'?'<br>':$char;
endif;

}
fclose($file);

書上說,fgetc函數(shù)會返回EOF,因此在循環(huán)內(nèi)部用feof函數(shù)判斷是否達到文件結束,如果到達就不回顯在瀏覽器上。
我就有個疑問,

PHP code?

$char = fgetc($file);

查看完整回答
反對 回復 2023-03-22
  • 1 回答
  • 0 關注
  • 93 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號