开发者

Hide content based on URL string (PHP)

开发者 https://www.devze.com 2023-01-06 20:57 出处:网络
I\'ve signed up to one of those affiliate sites to help drive traffic to my online store. They\'ve asked that开发者_JS百科 I hide the telephone number on my site for referring traffic.

I've signed up to one of those affiliate sites to help drive traffic to my online store. They've asked that开发者_JS百科 I hide the telephone number on my site for referring traffic.

All traffic that they refer will append any of my site urls with something like '?affiliate'.

Does anyone know how I can hide content on a page if a URL contains '?affiliate' but show it if the URL does not contain this text?

I'm using the Magento system, in case that makes a difference. :D

Thanks, Neil


if (!array_key_exists('affiliate', $_GET)) {
    //show telephone number
}

empty will fail here because the value of $_GET['affiliate'] will be "".


<?php
if (isset($_GET['affiliate'])) {
    // don't show
}
else {
    // show telephone number
}
?>


Try something like:

if (isset($_GET['affiliate']))
{
  // hide the content now
}
0

精彩评论

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