simonmesmith / yii2-googleadsense
该包已被弃用且不再维护。未建议替代包。
用于显示Google AdSense广告的扩展。
v1.1
2015-05-18 00:13 UTC
Requires
- php: >=5.4.0
- yiisoft/yii2: *
This package is not auto-updated.
Last update: 2021-06-25 23:39:15 UTC
README
用于显示Google AdSense广告的扩展。
安装
安装此扩展的首选方式是通过 composer。
运行以下命令之一
php composer.phar require --prefer-dist simonmesmith/yii2-googleadsense "*"
或者将以下内容添加到你的 composer.json 文件的 require 部分。
"simonmesmith/yii2-googleadsense": "*"
```
使用方法
扩展安装完成后
- 将以下参数添加到你的 params.php 文件中,以指定你的 AdSense 客户端 ID: 'googleAdSenseClient' => ''
- 可选地,在你的开发环境中禁用广告,并通过在 params-local.php 文件中添加以下参数来显示占位符: 'googleAdSenseEnable' => false
- 如下所示使用小部件来显示广告
'slot' => '<the ID of the ad slot>', 'style' => '<optional style information>', 'responsive' => '<optional value specifying whether the ad unit is responsive; defaults to false>' ]); ?>```