パスに文字列が含まれているかどうかを確認したいのですが、
同様に、パスに含まれる場合plugins
は return false
、パスに含まれる場合themes
は return true
。
D:\wamp\www\wp-content/plugins/someplugin/index.phtml // return false
D:\wamp\www\wp-content/themes/index.php // return true
パスに文字列が含まれているかどうかを確認したいのですが、
同様に、パスに含まれる場合plugins
は return false
、パスに含まれる場合themes
は return true
。
D:\wamp\www\wp-content/plugins/someplugin/index.phtml // return false
D:\wamp\www\wp-content/themes/index.php // return true
@Dave Chenが尋ねたからといって:
So what would wp-plugins or wp-themes trigger?
次に、完全一致を設定します。
$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