久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放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 刪除文件函數(shù)是什么?

      PHP 刪除文件函數(shù)是什么?

      PHP 刪除文件函數(shù)是什么?

      PHP刪除文件函數(shù)是“unlink()”,該函數(shù)用于刪除文件,其語(yǔ)法為“unlink(filename,context)”,其參數(shù)filename代表規(guī)定要?jiǎng)h除的文件,參數(shù)context是可選參數(shù),代表規(guī)定文件句柄的環(huán)境。

      示例代碼

      <?php $file = "test.txt"; if (!unlink($file))   {   echo ("Error deleting $file");   } else   {   echo ("Deleted $file");   } ?>

      函數(shù)封裝

      <?php  /**  * 創(chuàng)建文件操作  * @method create_file  * @param  str    $filename 文件名  * @return boolean          true|false             */ function create_file(string $filename){ 	if(file_exists($filename)){ 		return false; 	} 	// 檢測(cè)目錄是否存在,不存在則創(chuàng)建 	if(!file_exists(dirname($filename))){ 		mkdir(dirname($filename),0777,true);   //true是指是否創(chuàng)建多級(jí)目錄 	} 	// if(touch($filename)){ 	// 	return true; 	// } 	// return false; 	if(file_put_contents($filename,'')!==false){   // ''是指創(chuàng)建的文件中的內(nèi)容是空的 		return true; 	} 	return false; }       /**  * 刪除文件操作  * @param  string $filename 文件名  * @return boolean           true|false  */ function del_file(string $filename){ 	if(!file_exists($filename)|| !is_writeable($filename)){ 		return false; 	} 	if(unlink($filename)){ 		return true; 	} 	return false; }   // create_file("ceshi"); // del_file('ceshi');

      推薦教程:《PHP教程》

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