Home >Backend Development >PHP Tutorial > php怎么判断URL有关问题

php怎么判断URL有关问题

WBOY
WBOYOriginal
2016-06-13 13:19:13898browse

php如何判断URL问题
问题是的的:

有一个变量a
php判断当前url是否包含“jiaocheng”字符

如果包含则a为“baidu

如果不包含a为“google

先谢谢了。

------解决方案--------------------

PHP code
if(strpos($_SERVER['REQUEST_URI'],'jiaocheng') !==false)
      $a='<a href="www.baidu.com">baidu</a>';
else
       $a='<a href="www.google.com">google</a>'; <div class="clear">
                 
              
              
        
            </div>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn