怎麼設定html頁頭

來源:互聯網
上載者:User
如何設定html頁頭
本帖最後由 dd0607 於 2014-01-06 01:42:27 編輯

index.php
include("include/conn.php");
include("header.php");
include("footer.php");
?>


conn.php
$host='localhost';  
$user_name='root';
$password='123123';
$db='netbox';
$conn = mysqli_connect($host,$user_name,$password,$db) or die("Connect failed: " . mysqli_connect_error());
?>


header.php






test





footer.php





當index.php不載入conn.php,頁面顯示正常
當載入conn.php後,頁面會自己添加html/head/body等html標籤,同時去除了我header.php裡的DOCTYPE/html/head,其他內容則統統丟進body裡,這是什麼原因造成的呢?

PS:載入conn.php後右擊頁面查看源碼,是正常的,但顯示是有問題的 會在頁面頂部頂出一行空白,IE11和Chrome33按F12查看HTML代碼就會發現已經不正常了



剛從ASP轉PHP,ASP這樣邏輯寫法是沒問題,不懂PHP問題出在哪裡

分享到: 更多


------解決方案--------------------
把conn.php逐行注釋檢查
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.