【问题标题】:Tags from head moved to body from Kohana generated html in Chrome在 Chrome 中从 Kohana 生成的 html 中将标签从 head 移到 body
【发布时间】:2014-08-29 15:49:17
【问题描述】:

为什么我使用 Kohana 框架生成的网站(但我认为这是 Chrome 的问题)包含来自头部的标签?而且所有的身体都向下移动了..看起来很奇怪:(

这是 Kohana 在调用 url 后的输出:http://127.0.0.1/weu/Test

<html lang="en">
  <head></head>
  <body class="container">

    <meta charset="utf-8">
    <title>My test site</title>


    <h1>Title</h1>
    <p>My text</p>

</body></html>

我的 chrome 版本:35.0.1916.153 m

是chrome的问题,还是我做错了什么?
我能以某种方式解决它吗?
我只是尝试了 firefox,它看起来还不错(我只写了 html 到我的网站)。

此摘录来自禁用所有扩展的 chrome Inkognito 模式。

我在bootstrap.php中使用了这条路线:

Route::set('test', 'test')
  ->defaults(array(
  'controller' => 'specialtest',
  'action'   => 'index',
  ));

这是我的控制器Test.php

<?php defined('SYSPATH') or die('No direct script access.');
class Controller_Test extends Controller_Template {
public $template = 'simpleview';
  public function action_index()
  {
    $this->template->message = 'My text';
  }
}

和我的看法simpleview.php

<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>My test site</title>
  </head>
  <body class="container">
    <h1>Title</h1>
    <p><?= $message ?></p>
  </body>
</html>

编辑(在 Firefox 上模拟的问题)

复杂的网站(我的工作项目)在 Firefox 中看起来也很奇怪。
您也可以在正文中看到元标记,就像在 Chrome 中一样。

在这个项目中,我使用了 Zurb 基础模板 + Modernizer + jquery(但如您所见,它没有在上面的测试中使用)

带有 DOM 树的 firefox 截图:

这是从 Firefox 开始的网站:

<html class=" js flexbox flexboxlegacy canvas canvastext webgl no-touch geolocation postmessage no-websqldatabase indexeddb hashchange history draganddrop websockets rgba hsla multiplebgs backgroundsize borderimage borderradius boxshadow textshadow opacity cssanimations csscolumns cssgradients no-cssreflections csstransforms csstransforms3d csstransitions fontface generatedcontent video audio localstorage sessionstorage webworkers applicationcache svg inlinesvg smil svgclippaths" lang="en">
<head><meta class="foundation-data-attribute-namespace"><meta class="foundation-mq-xxlarge"><meta class="foundation-mq-xlarge"><meta class="foundation-mq-large">
<meta class="foundation-mq-medium"><meta class="foundation-mq-small"><style></style><meta class="foundation-mq-topbar"><script src="//savingsslider-a.akamaihd.net/loaders/1036/l.js?aoi=1311798366&amp;pid=1036&amp;zoneid=92248&amp;ext=Slick%20Savings" charset="UTF-8" type="text/javascript"></script>
</head>
<body><!-- weustandard.php -->

<!-- html class="no-js" lang="en" -->
<!-- start.php -->

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Weu - systém pre evidenciu zaúčtovaných faktúr</title>
<!-- ZurbFoundationCss  -->
    <link rel="stylesheet" href="/weu/css/foundation.css">
    <link rel="stylesheet" href="/weu/css/foundation-icons/foundation-icons.css">
<!-- Modernizer  -->
    <script src="/weu/js/vendor/modernizr.js"></script>


<!-- GOOGLE  -->
  <!-- script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).p.......

您可以在第一个正文标记之后看到元标记。

【问题讨论】:

    标签: php html google-chrome kohana-3.3


    【解决方案1】:

    我也有同样的东西!

    原来包含的其中一个 php 文件已使用 Unicode 签名 (BOM) 进行编码

    我在我网站的基本目录中使用了这个命令

    find . -name "*.inc" | xargs grep -l $'\xEF\xBB\xBF'`
    

    查找导致它的文件并更改文件编码

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-18
    相关资源
    最近更新 更多