我现在正在考虑在我的网站上放一些广告。最重要的是,Adsterra对我来说似乎很好。我在那里注册并获得一些代码,可以在我的网站上展示他们的广告。
代码如下:
<script type="text/javascript">
atOptions = {
'key' : '0000',
'format' : 'iframe',
'height' : 250,
'width' : 300,
'params' : {}
};
document.write('<scr' + 'ipt type="text/javascript" src="http' + (location.protocol === 'https:' ? 's' : '') + '://www.example.com/invoke.js"></scr' + 'ipt>');
我放在WordPress博客上,它很好,但是当我的其他php组成部分时,这使这些部分空白或出现错误。
我检查了错误日志文件,它是:
PHP解析错误:语法错误,意外的“键”(T_STRING),预期为“,”或“;” 在第60行的/home/fajlamic/public_html/links/inc/head.php中
我将整个head.php
文件添加到了平底锅>> http://codepen.io/anon/pen/mepqEq
我已经在Google搜索中以及在StackOverflow中进行了一些搜索,但似乎对我没有任何帮助。谁能告诉我如何修改自己拥有的内容,以便它可以正常运行?
您可以做两件事。1)先停止,<?php
然后再开始浏览<style>
到页面底部,或者2)逸出所有javascript单引号:
选项1:转义
'<script type="text/javascript">
atOptions = {
\'key\' : \'61aeec1e4ef0ef989337d9ed0f8800be\',
\'format\' : \'iframe\',
\'height\' : 250,
\'width\' : 300,
\'params\' : {}
};
document.write(\'<scr\' + \'ipt type="text/javascript" src="http\' + (location.protocol === \'https:\' ? \'s\' : \'\') + \'://www.bnhtml.com/invoke.js"></scr\' + \'ipt>\');
</script>';
选项2:停止php
'<meta name="Robots" content="All,Index,Follow">';
// Stop php here since you don't have anymore php-generated variables below this part
?>
<!-- start html here -->
<style>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句