WP_Filesystem_Direct::touch( string $file, int $time, int $atime ): bool

In this article

Sets the access and modification times of a file.

Description

Note: If $file doesn’t exist, it will be created.

Parameters

$filestringrequired
Path to file.
$timeintoptional
Modified time to set for file.
Default 0.
$atimeintoptional
Access time to set for file.
Default 0.

Return

bool True on success, false on failure.

Source

public function touch( $file, $time = 0, $atime = 0 ) {
	if ( 0 === $time ) {
		$time = time();
	}

	if ( 0 === $atime ) {
		$atime = time();
	}

	return touch( $file, $time, $atime );
}

Changelog

VersionDescription
2.5.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.