PHP代码未在浏览器中呈现 [英] PHP code not being rendered in browsers

查看:47
本文介绍了PHP代码未在浏览器中呈现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文件manage.php,其中包含php代码,如下所示.

I have a file, manage.php, which contains php code, as depicted below.

其他文件在同一台PC和同一台服务器(我使用WAMP)上也可以正常工作.并且代码可以正常地与MySQL数据库交互,以在另一页上实现登录机制...

Other files are working fine on the same PC and same server (I use WAMP). And the code is working correctly interacting with MySQL databases for a login mechanism on another page...

由于某种原因,该代码无法在FF或Chrome中呈现.如您所见,在chrome中,该代码被html注释块注释掉,没有打印或读取任何内容,等等.我没有在文本编辑器中编写类似的代码.

For some reason the code is not rendered in either FF or Chrome. In chrome, as you can see, the code gets commented out by html comment blocks and nothing prints or is read, etc. I did not write the code like that in my text editor.

我很沮丧.有什么想法吗?

I am frustrated. Any ideas?

http://captainscall.site11.com/temp_stuff/why-php.PNG

这是manage.php的完整脚本:

Here is the full script for manage.php:

<?php 
/*
    /admin/index.php
    admin area for Neos Massage
    Made by Douglas Franz, freelance PHP/MySQL/HTML/CSS/JS/jQuery-ist.
*/

session_start();
include('models/auth.php');
include('includes/database.php');
?>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Neos Massage Admin Area</title>
    <script type="text/javascript" src="js/jquery.js"></script>
    <link rel="stylesheet" type="text/css" href="css/admin.css" />
    </head>

<body>

    <div id="admin_header"> 
        <img src="../images/header-background-restored-flower-no-color.png" style="vertical-align: top;"/>
        <span><b>Admin Area</b><br /><?php if (isset($_SESSION['uName'])) { echo $_SESSION['uName']; } ?></span>
        <div id="border">
        <img src="../images/border.png" width="100%" height="20"/>
        </div>
    </div>  

    <div id="admin_content">

        <h1 style="color: #402d11;">Neos Massage - Manage</h1>
            <hr />
            <a href="index.php?logout">logout</a>
            <br />
            <?php var_dump($_SESSION); echo "this is a test"; ?>
            <?php print "this is a test"; ?>



    </div>


</body>
</html>

推荐答案

如果您说的是真的,那么其他 *.php 文件也可以正常运行,我的假设是编码您将文件保存在其中会导致问题.

If what you are saying is true, that other *.php files run without a problem, my assumption would be that the encoding you are saving the file in is causing the problem.

<!-?php <-哪些Chrome浏览器正在更改PHP标签,以使我认为文档的编码不正确.

<!--?php <- What Chrome is changing the PHP tag to make me think the encoding of the document is incorrect.

尝试将文件另存为新文档,或者将代码复制并粘贴到新文档中,然后另存为新文件.我敢打赌,这可以解决您的问题.

Try saving the file as a new document, or copy and pasting the code into a new document and saving it as a new file. I would bet that fixes your issue.

这篇关于PHP代码未在浏览器中呈现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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