不知怎的php打破了doctype [英] Somehow php broke doctype

查看:82
本文介绍了不知怎的php打破了doctype的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了两个线程查看从服务器传送的实际网页内容。






编辑:你会发现RAW和HEX选项卡比TextView更重要。从Raw开始,比较Content-Length标题,然后查看HexView,看看发生了什么变化。


I created two threads here and here about that internet explorer works in quirks mode and that broke the layout. After a bit of investigation I found that somehow php make some mess.

For example If I run the code below as html page on web server IE parse it correctly.I`m using small CMS, so if I divide the code in three parts lets say header main footer (CMS combine them) then IE show quirks mode and the layout is broken. The html output from php file is the same as that below.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
        <style type="text/css" media="screen">
            body{
                font: 11px Tahoma, Verdana, Arial, sans-serif;
                color: #707070;
                background: #8c2727 url('../img/bgr_red.png') repeat-x;
            }

            a {
                color:#bc2828;
                text-decoration:none;
                font-weight: bold;
                outline: none;
            }


            #wrapper{
                position: relative;
                width: 960px;
                margin: 70px auto;
                background-color: #fff;
                border: 1px solid red;
            }

        </style>
    </head>

    <body>
    <div id="wrapper">
        <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    </div>
    </body>
    </html>

I belive that the problem is in CMS. But what could broke the doctype ?

EDIT: Here is screenshot from Fiddler

解决方案

If a browser is treating the two pages differently, then there's some difference between them, even if it's not immediately apparent when you "View Source".

I recommend using a tool such as Fiddler to look at the actual page content as delivered from the server.


Edit: You'll find that the "RAW" and "HEX" tabs are more important than "TextView". Start with "Raw" and compare the "Content-Length" header, then look at "HexView" to see what has changed.

这篇关于不知怎的php打破了doctype的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆