2015-07-21 69 views
4

我有以下url结构。检查url是否包含某个字,然后显示

example.com/items/something_something. 

什么是php代码来检查url包含单词“items”,然后显示某些div?

<?php if() { ?> <!--Check if url contains the word "items" --> 
    Show this 
<?php } else { ?> 
    Don't show this 
<?php } ?> 

感谢

回答

10

if(strpos($_SERVER['REQUEST_URI'], 'items') !== false){

相关问题