WP_Filesystem_Direct::touch
Sets the access and modification times of a file.
Note: If $file doesn't exist, it will be created.
Method of the class: WP_Filesystem_Direct{}
No Hooks.
Returns
true|false. True on success, false on failure.
Usage
$WP_Filesystem_Direct = new WP_Filesystem_Direct(); $WP_Filesystem_Direct->touch( $file, $time, $atime );
- $file(string) (required)
- Path to file.
- $time(int)
- Modified time to set for file.
- $atime(int)
- Access time to set for file.
Changelog
| Since 2.5.0 | Introduced. |
WP_Filesystem_Direct::touch() WP Filesystem Direct::touch code WP 6.9.1
public function touch( $file, $time = 0, $atime = 0 ) {
if ( 0 === $time ) {
$time = time();
}
if ( 0 === $atime ) {
$atime = time();
}
return touch( $file, $time, $atime );
}