google-ads-api - 如何在 codigniter 中实现 google adsense
问题描述
<script data-ad-client="ca-pub-xxxxxxxxxxxxxxxx" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>`<ins class="adsbygoogle"
style="display:inline-block;width:728px;height:90px"
data-ad-client="ca-pub-xxxxxxxxxxxxxxxx"
data-ad-slot="xxxxxxxxxx"></ins>
解决方案
将 google adsense 代码存储在通用视图文件中,并将其加载到所需的视图页面中。
例如,将 adsense 代码保存在 adsense.php 视图文件中,并使用以下代码在所需文件中调用它
<?php $this->load->view('adsense'); ?>
推荐阅读
- python - 如何将世纪值(即 1900 和 2000)添加到 pandas 列中的十年
- python-2.7 - 熊猫新专栏有条件
- c# - 如何在有头的 UWP IoT Core 应用程序中调用 IHost 的 Run()
- android - 我已经创建了通知通道,但在 Android 8.1.0 上崩溃的可能性仍然很低 startForeground 的错误通知
- android - 当我阅读条形码时,Listview 项目数据重复
- google-cloud-platform - 在获得谷歌云计算引擎的管理员访问权限后,如何创建项目和 VM 实例?
- javascript - 我想制作一个函数,在 php 中按函数打印插入查询。问题 :
- mysql - 1 小时内的 MySQL 查询选择
- stackdriver - Stackdriver 保留政策为 30 天。Stackdriver 信息中心如何设法显示过去 6 周的数据?
- android - 我可以使用整个原生项目与原生 UI 进行原生反应吗?