wp_delete_file

函式
wp_delete_file ( $file )
引數
  • (string) $file The path to the file to delete.
    Required:
定義位置
相關方法
wp_delete_sitewp_delete_linkwp_delete_termwp_delete_userwpmu_delete_user
引入
4.2.0
棄用
-

wp_delete_file:此函式從WordPress檔案系統中刪除檔案。它將檔案路徑作為引數,並從伺服器中刪除檔案。

刪除一個檔案。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function wp_delete_file( $file ) {
/**
* Filters the path of the file to delete.
*
* @since 2.1.0
*
* @param string $file Path to the file to delete.
*/
$delete = apply_filters( 'wp_delete_file', $file );
if ( ! empty( $delete ) ) {
@unlink( $delete );
}
}
function wp_delete_file( $file ) { /** * Filters the path of the file to delete. * * @since 2.1.0 * * @param string $file Path to the file to delete. */ $delete = apply_filters( 'wp_delete_file', $file ); if ( ! empty( $delete ) ) { @unlink( $delete ); } }
function wp_delete_file( $file ) {
	/**
	 * Filters the path of the file to delete.
	 *
	 * @since 2.1.0
	 *
	 * @param string $file Path to the file to delete.
	 */
	$delete = apply_filters( 'wp_delete_file', $file );
	if ( ! empty( $delete ) ) {
		@unlink( $delete );
	}
}

常見問題

FAQs
檢視更多 >