Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/262.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 仅显示谷歌AdSense广告的Twitter访问者_Php_Twitter_Preg Match_Strpos_Http Referer - Fatal编程技术网

Php 仅显示谷歌AdSense广告的Twitter访问者

Php 仅显示谷歌AdSense广告的Twitter访问者,php,twitter,preg-match,strpos,http-referer,Php,Twitter,Preg Match,Strpos,Http Referer,我只想在访客来自Twitter时显示我的Google Adsense广告。目前我正在使用这段代码,这对Facebook和其他网站有效,但对Twitter无效 <?php $ref = $_SERVER['HTTP_REFERER']; if (strpos($ref, 'twitter.com') != false) {?> <script type="text/javascript"><!-- go

我只想在访客来自Twitter时显示我的Google Adsense广告。目前我正在使用这段代码,这对Facebook和其他网站有效,但对Twitter无效

    <?php
            $ref = $_SERVER['HTTP_REFERER'];
            if (strpos($ref, 'twitter.com') != false) {?>
 <script type="text/javascript"><!--
    google_ad_client = "xx-xx-xxxxxxxxxxxxxxxxxx";
    /* xxxxxxxx xxxxxx xxx xxx xxx xx xxxxxx */
    google_ad_slot = "xxxxxxxxxxxxxx";
    google_ad_width = xxx;
    google_ad_height = xxx;
    //-->
    </script>
    <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
</div>
</div>

<?php }else{
  echo "";  }
  ?>

Twitter通过
寻找t.co推荐人

请不要破坏您的帖子。一旦您发布了一个问题,您就已经根据CC by SA许可证将内容授权给了Stack Overflow社区。如果您想解除此帖子与您帐户的关联,请参阅。