php - Google Analytics 导致 500 内部错误

标签 php javascript ajax google-analytics

使用从谷歌分析产品生成的代码:(信息经过审查)

<meta name="google-site-verification" content="xxxxxxxxxxxx" />



<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'xxxxxxxx']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 
    'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 
    'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; 
    s.parentNode.insertBefore(ga, s);
  })();

</script>

导致内部500错误,代码在head标签中

最佳答案

如果您的网站使用 Smarty 模板引擎,只需将此代码粘贴到模板中就会导致 500 内部服务器错误,因为模板无法正确解释代码。

将代码粘贴到

{literal} 
...
{/literal}

阻止你的问题就会得到解决!

Logicia.co.uk blog 大声喊叫这帮助我解决了同样的问题。

关于php - Google Analytics 导致 500 内部错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13312290/

相关文章:

php - Laravel 验证 : Validating OR instead of AND

javascript - jquery点击事件只影响第一个元素

javascript - 创建一个具有特定原型(prototype)的空对象

javascript - 从外部域调用 WCF 服务

javascript - AJAX查询后格式化字段

javascript - ajax成功响应更改为@html.raw

php - 将 Ubuntu 时钟源从 xen 切换到 tsc 会影响 php/Laravel 应用程序吗?

php - PHP json_encode无法部分处理数组

php - 在 MySQL 表中存储用户密码的最佳 PHP 哈希方法?

javascript - 如何将 ISO 日期转换为日期格式 yyyy-mm-dd?