WP_CLI\Utils\make_temp_file()
Create a unique temporary file safely without following symlinks.
Usage
WP_CLI\Utils\make_temp_file( $prefix = wp-cli-, $suffix = '' )
$prefix (string) Optional. Prefix for the temporary file name. Default 'wp-cli-'.
$suffix (string) Optional. Suffix for the temporary file name. Default ''.
@return (string) to the created temporary file.
$suffix (string) Optional. Suffix for the temporary file name. Default ''.
@return (string) to the created temporary file.
Notes
The file is only readable and writable by its owner on non-Windows systems.
The file is created in the directory returned by WP-CLI's get_temp_dir()
(based on sys_get_temp_dir()), not WordPress's get_temp_dir(), and is
not removed automatically; callers are responsible for cleaning it up.
On failure, this function exits via WP_CLI::error() rather than throwing.
Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.
Related
- WP_CLI\Utils\get_home_dir() - Get the home directory.
- WP_CLI\Utils\trailingslashit() - Appends a trailing slash.
- WP_CLI\Utils\is_stream() - Check if a path is a PHP stream URL.
- WP_CLI\Utils\normalize_path() - Normalize a filesystem path.
- WP_CLI\Utils\get_temp_dir() - Get the system's temp directory. Warns user if it isn't writable.
- WP_CLI\Utils\make_temp_dir() - Create a unique temporary directory safely without following symlinks.
- WP_CLI\Utils\get_php_binary() - Get the path to the PHP binary used when executing WP-CLI.
- WP_CLI::get_php_binary() - Get the path to the PHP binary used when executing WP-CLI.
这篇文档对你有帮助吗?
谢谢你的反馈!