开发者

Creating If/Else based on URL of page

Basically what I'm trying to do is create an if/else statement based on the URL of the current site im on. The if/else statement is going to echo a list based on an alphabetical range. So in other words, If the url starts with letters between (A-G) I want it to echo one thing, and if it starts with letters (H-Z) I want it to echo something else. Th开发者_C百科is script will be used on many websites. Thanks


<?php
    $uri = strtoupper(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/CLI');
    if(ord($uri[1]) <= ord('G'))
        echo "Echo one thing";
    else
        echo "Echo something else";


look into $_SERVER['REQUEST_URI']

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜