-1

首先,让我向您展示一些代码:

索引.php

<a href="new-directory-dialog.php" data-role="button" data-rel="dialog" data-transition="slidedown"><?php echo localize('New directory'); ?></a>

因此,如您所见,我使用new-directory-dialog.php作为对话窗口。在本地机器上一切正常,在 Win 7 x64 上使用 Wamp 服务器。但是在我的 Web 主机服务器上,每个对话框页面都显示有 ?> (或 ?>)字符。Firebug 中的 HTML 选项卡显示以下输出:

<html class="ui-mobile">
<head>
<base href="http://pantljika-online.info/link/new-directory-dialog.php">
</head>
<body class="ui-mobile-viewport ui-overlay-a">
?>
<title>Novi direktorij</title>
<meta charset="utf-8">
<meta content="width=device-width, initial-scale=1" name="viewport">

我不知道为什么会这样。这是对话框页面的完整代码:

<?php
include('localize.php');
?>
<!DOCTYPE html>
<html>
    <head>
        <title><?php echo localize('New directory'); ?></title>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
        <script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
        <script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
    </head>
    <body>
        <div data-role="page" data-theme="<?php echo $_SESSION['data-theme']; ?>" >
            <form action="index.php" method="post">
                <fieldset>
                    <div data-role="header">
                        <h1><?php echo localize('New directory'); ?></h1>
                    </div>

                    <div data-role="content">
                        <label for="new-directory-name">
                            <?php echo localize('Name'); ?>:
                        </label>
                        <input type="text" id="new-directory-name" name="new-directory-name" />
                    </div>

                    <div data-role="footer">
                        <h4>
                            <button type="submit" name="submit" value="submit-value"><?php echo localize('Create'); ?></button>
                        </h4>
                    </div>
                </fieldset>
            </form>
        </div>
    </body>
</html>
4

1 回答 1

0

好的,问题解决了。我在其中一个包含的 php 文件中删除了 PHP 结束标记 (?>),它停止显示在对话框中。此外,我必须在没有 BOM 的情况下将所有 php 文件从 UTF8 编码为 UTF8。否则 jQuery 会将 head 元标记和标题标记放在 body 元素中......

于 2013-01-19T22:59:17.143 回答