php - Check if path contain a string -
i want check if path contain string,
like, if path contain plugins
return false
, , if path contain themes
return true
.
d:\wamp\www\wp-content/plugins/someplugin/index.phtml // return false d:\wamp\www\wp-content/themes/index.php // return true
just because @dave chen asked :
so wp-plugins or wp-themes trigger?
then, set exact match :
$themes = "/themes/"; $file01 = "d:\wamp\www\wp-content/themes/index.php"; $file02 = "d:\wamp\www\wp-content/wp-themes/index.php"; $is_theme = stripos($file01, $themes ); // returns true $is_theme = stripos($file02, $themes ); // returns false
Comments
Post a Comment