Current Location: Home> Function Categories> delete

delete

See unlink() or unset() (PHP does not have delete keywords or functions)
Name:delete
Category:File system
Programming Language:php
One-line Description:See unlink() or unset().

实例

<span class="token php language-php"><span class="token delimiter important"><?php</span>
<span class="token variable">$file</span> <span class="token operator">=</span> <span class="token string double-quoted-string">"test.txt"</span><span class="token punctuation">;</span>
<span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span><span class="token function">unlink</span><span class="token punctuation">(</span><span class="token variable">$file</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
  <span class="token punctuation">{</span>
  <span class="token keyword">echo</span> <span class="token punctuation">(</span><span class="token string double-quoted-string">"Error deleting <span class="token interpolation"><span class="token variable">$file</span></span>"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>
<span class="token keyword">else</span>
  <span class="token punctuation">{</span>
  <span class="token keyword">echo</span> <span class="token punctuation">(</span><span class="token string double-quoted-string">"Deleted <span class="token interpolation"><span class="token variable">$file</span></span>"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>
<span class="token delimiter important">?></span></span>
Similar Functions
  • Create a new directory mkdir

    mkdir

    Createanewdirectory
  • Create a temporary file tmpfile

    tmpfile

    Createatemporaryfile
  • Return to the directory part in the path dirname

    dirname

    Returntothedirectory
  • Close an open file pointer fclose

    fclose

    Closeanopenfilepoint
  • Determine whether the file is uploaded through HTTP POST is_uploaded_file

    is_uploaded_file

    Determinewhetherthef
  • Get file information through the opened file pointer fstat

    fstat

    Getfileinformationth
  • Test whether the file pointer reaches the end of the file feof

    feof

    Testwhetherthefilepo
  • Read characters from file pointer fgetc

    fgetc

    Readcharactersfromfi