(記事修正中)ディレクトリ名を取得して表示を分岐

<?php if(preg_match("/test/",$_SERVER["REQUEST_URI"])): ?> testディレクトリで表示される内容 <?php elseif(preg_match("/test02/",$_SERVER["REQUEST_URI"])): ?> test02ディレクトリで表示される内容 <?php else: ?> その他で表示される内容 <?php endif; ?>
■動かない場合”の記述を変えれば動くかもしれない
<?php elseif(preg_match("#^/test/#",$_SERVER["REQUEST_URI"])): ?>
参考サイト
-
前の記事
現在の日にちを基準に◯日間・・というセレクトボックスを自動生成 2016.10.25
-
次の記事
リンク先のogpを取得するphp 2016.10.25