CodeIgniter Head清空并且在body中有内容

时间:2017-06-19 20:18:33

标签: php html5 codeigniter frameworks codeigniter-3

嘿,我不明白我的网站不起作用我没有做任何事情所以我会解释

我现在在页面上排名第一! Google Chrome浏览器:Screenshot https://validator.w3.org/nu/?doc=http%3A%2F%2Fwww.wisementrade.com%2F

View/header.php: https://pastebin.com/7GqFYR75

View/homepage.php: https://pastebin.com/3htmFSmw

View/footer.php: https://pastebin.com/b3X9KScg

Controller/View.php: https://pastebin.com/cxCdcdEQ

Chrome viewer code: https://pastebin.com/Q8VYja5u

我检查了编码UTF-8,我用我的崇高文本重新编码UTF-8,但没有任何变化......请需要帮助

编辑:修复

2 个答案:

答案 0 :(得分:0)

我认为未封闭的HTML标记会导致此问题。我在View / header.php中找到了一些未关闭的HTML标记。关闭它。试试这个。

<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>
<!DOCTYPE HTML>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
        <meta name="viewport" content="width=device-width, initial-scale=1"/>
        <!--o-->
        <?php
        //Session
        $customer_id = $this->session->userdata('customer_id');
        $user_type = $this->session->userdata('user_type');
        $statement = $this->session->userdata('timezone');

        ?>
        <!--o-->
        <link rel="icon" type="image/png" href="<?php echo base_url('images/favicon.png'); ?>" />
        <meta name="author" content="Wise Men Trade" />
        <meta name="copyright" content="Copyright Notice ©2015 WisemenTrade Limited and licensors. All rights reserved." />
        <meta name="robots" content="all" />
        <!--o-->
        <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
        <script language="JavaScript" type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
        <!-- Bootstrap CSS -->
        <link href="<?php echo base_url("css/bootstrap.min.css"); ?>" rel="stylesheet"/>
        <!-- Basic CSS -->
        <link href="<?php echo base_url("css/style.css"); ?>" rel="stylesheet"/>
        <!-- Responsive CSS -->
        <link href="<?php echo base_url("css/responsive.css"); ?>" rel="stylesheet"/>
        <!-- Important Owl stylesheet -->
        <link rel="stylesheet" href="<?php echo base_url("css/owl-carousel/owl.carousel.css"); ?>"/>
        <!-- Default Theme -->
        <link rel="stylesheet" href="<?php echo base_url("css/owl-carousel/owl.theme.css"); ?>"/>
        <!-- MS DROP DOWN -->
        <link rel="stylesheet" href="<?php echo base_url('css/msdropdown/flags.css'); ?>"/>
        <link rel="stylesheet" href="<?php echo base_url('css/msdropdown/dd.css'); ?>"/>

        <!-- Google Analytics -->
        <script>
            (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
            (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
            m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
            })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

            ga('create', 'UA-62333409-1', 'auto');
            ga('send', 'pageview');
        </script>
        <!-- End Google Analytics -->

    </head>

<body>
<!--top-header-->
    <header>
        <div class="header_block">
            <!-- left -->
            <div class="block_left">
                <a href="<?php echo base_url(); ?>">
                    <img src="<?php echo base_url("images/log_wmt.png"); ?>" class="logo" width="130" height="130" alt="Logo Wise Men Trade" />
                </a>
            </div>
        </div>
    </header>

也在您的Controller / View.php中有一些未闭合的div(<div id="container"><div class="block_content">)。检查并关闭它。

最后一个,确保在Controller / View.php的末尾有一个:

</body> <!-- end of body -->
</html> <!-- end of html -->

答案 1 :(得分:0)

根据文档(https://www.codeigniter.com/user_guide/general/views.html),你可以在你的控制器中加载多个视图,我认为如果你在视图中加载它就不起作用,所以你应该有这样的东西:

<?php

class Page extends CI_Controller {

        public function index()
        {
                $data['page_title'] = 'Your title';
                $this->load->view('header');
                $this->load->view('menu');
                $this->load->view('content', $data);
                $this->load->view('footer');
        }

}