Hide content based on URL string (PHP)
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
}
精彩评论