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
  • Test whether the file pointer reaches the end of the file feof

    feof

    Testwhetherthefilepo
  • Get file information through the opened file pointer fstat

    fstat

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

    is_uploaded_file

    Determinewhetherthef
  • Export buffered content to file fflush

    fflush

    Exportbufferedconten
  • Give information about a file or symbol connection lstat

    lstat

    Giveinformationabout
  • Determine whether the given file name is a directory is_dir

    is_dir

    Determinewhethertheg
  • Get the inode modification time of the file filectime

    filectime

    Gettheinodemodificat
  • Copy the file copy

    copy

    Copythefile