久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長(zhǎng)資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      php怎么判斷刪除文件是否成功

      在php中,可以利用if語(yǔ)句和unlink()函數(shù)來(lái)判斷刪除文件是否成功,語(yǔ)法“if(unlink($file)){echo '文件刪除成功!';}else{echo '文件刪除失?。?#39;;}”。

      php怎么判斷刪除文件是否成功

      本教程操作環(huán)境:windows7系統(tǒng)、PHP7.1版、DELL G3電腦

      在php中,想要?jiǎng)h除文件,需要使用unlink() 函數(shù)。

      unlink() 函數(shù)可以刪除指定的文件,函數(shù)執(zhí)行成功(刪除文件成功)時(shí)返回 TRUE,失敗時(shí)返回 FALSE。

      而想要判斷刪除文件是否成功,可以借助if語(yǔ)句。如何unlink() 函數(shù)回 TRUE,則輸出刪除文件成功的提示;如果返回 FALSE,則輸出刪除文件失敗的提示。

      實(shí)現(xiàn)代碼:

      <?php header("Content-type:text/html;charset=utf-8"); $file = 'newtest.txt'; if (file_exists($file)) { 	if (unlink($file)) { 		echo '文件刪除成功!'; 	} else { 		echo ' 文件刪除失敗!'; 	} } else { 	echo $file . ' 不存在!'; } ?>

      輸出結(jié)果:

      php怎么判斷刪除文件是否成功

      推薦學(xué)習(xí):《PHP視頻教程》

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)