Created
October 26, 2016 10:59
-
-
Save Restoration/0540fa9237e3d0a53b065ab682966d65 to your computer and use it in GitHub Desktop.
ファイルが存在するかチェックする
This file contains hidden or 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 | |
| /** | |
| * ファイルが存在するかチェックする | |
| * | |
| * @param string | |
| * @param string | |
| * @return boolean | |
| */ | |
| function check_file_exists($dir,$file_name){ | |
| if(substr($dir,-1) !== "/"){ | |
| $dir .= "/"; | |
| } | |
| echo "test"; | |
| $file_name = $dir.$file_name; | |
| if(file_exists($file_name)){ | |
| return true; | |
| } else { | |
| return false; | |
| } | |
| } | |
| $dir = "test"; | |
| $name = "sample_image.jpgf"; | |
| var_dump(check_file_exists($dir,$name)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment