dongyang4615
dongyang4615
2016-10-20 17:37

查找url查询“id”是否等于tab-1

已采纳

This is what I have for my code.

$query = $_GET['id'];

if(isset($query) == tab-1) {
    echo $query;
}else{
    echo "nope";
}

The above code is checking if my url has /?id but it isn't checking if the ?id is equal to tab-1.

It returns true even if my url is /?id=tab-2 and $query is equal to tab-2.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

2条回答

  • doutuobao9736 doutuobao9736 5年前
    if(isset($_GET['id'])) {
        $query = $_GET['id'];
    
        if($query == "tab-1") {
           echo $query;
        } else {
           echo "nope";
        }
    }
    
    点赞 评论 复制链接分享
  • douhui7136 douhui7136 5年前

    <?php
    $query = $_GET['id'];
    
    if($query == "tab-1") {
        echo $query;
    }else{
        echo "nope";
    }
    ?>

    </div>
    
    点赞 评论 复制链接分享