Home  >  Article  >  Backend Development  >  Tips Sharing PHP Delete Copied Files_PHP Tutorial

Tips Sharing PHP Delete Copied Files_PHP Tutorial

WBOY
WBOYOriginal
2016-07-15 13:34:33819browse

  1. < ?PHP
  2. $file = 'dirlist.PHP';
  3. $result = @unlink ($file);
  4. if ($result == false) {
  5. echo 'The mosquitoes are gone ';
  6. } else {
  7. echo 'Cannot be driven away';
  8. }
  9. ?>

That’s it.

It’s also easy to delete copied files in copied files with PHP:

<ol class="dp-xml"><li class="alt">
<span class="tag"><</span> ?PHP  </li><li><span>$</span><span class="attribute">file</span><span> = </span><span class="attribute-value">'yang.txt'</span><span>;  </span></li><li class="alt"><span>$</span><span class="attribute">newfile</span><span> = </span><span class="attribute-value">'ji.txt'</span><span>; # <br />这个文件父文件夹必须能写  </span></li><li><span>if (file_exists($file) == false) {  </span></li><li class="alt"><span>die ('小样没上线,无法复制');  </span></li><li><span>}  </span></li><li class="alt"><span>$</span><span class="attribute">result</span><span> = </span><span class="attribute-value">copy</span><span>($file, $newfile);  </span></li><li><span>if ($</span><span class="attribute">result</span><span> == false) {  </span></li><li class="alt"><span>echo '复制记忆ok';  </span></li><li><span>}  </span></li><li class="alt"><span class="tag">?></span><span> </span>
</li></ol>

The above is a summary of related techniques for deleting copied files in PHP.


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/445970.htmlTechArticle?PHP $ file = 'dirlist.PHP' ; $ result =@unlink($file); if($ result ==false){ echo'The mosquitoes were driven away'; }else{ echo'Can't be driven away'; }? That's it. PHP deletes the copied files in the copied files with the same...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn