if you need for theme you can use my function
function file_checker($file){
//http://localhost/wordpress/wp-content/themes/THEMEName
$location = get_template_directory_uri();// you can edit this <=
$location = str_replace("http://","",$location);
$location = str_replace("https://","",$location);
$location = str_replace($_SERVER['HTTP_HOST'],"",$location);
$location = $_SERVER['DOCUMENT_ROOT'].$location;
$filename = $location.$file;
ifreturn (file_exists($filename)) {
return true;
} else {
return false;;
}
}
use
if(file_checker("/style.css")){
echo "file Has";
}else{
echo " Error Location , Check Your Code";
}