-
-
Save tommcfarlin/fc9558899bc3f89fe247 to your computer and use it in GitHub Desktop.
[WordPress] Touch a File (Before Creating It)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Assume that $name is specified earlier in the code | |
$filename = dirname( __FILE__ ) . "/$name.json"; | |
// If the is able to be touched, we're good to go... | |
if ( touch ( $filename ) ) { | |
// We're able to write to the file | |
} else { | |
// There was a problem trying to write to the file | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment