开发者

My PHP code is just a comment in my HTML content

I have a basic HTML page with some JavaScript code on it, and when I try to put any PHP code in the body, it reads it as a comment.

<html>
    <head>
        <link rel="stylesheet" href="style.css" type="text/css" media="screen">
        <script type="text/javascript" src="jquery-1.3.2.min.js"></script>
        <script type="text/javascript" src="jquery.tablesorter.min.js"></script>
        <script type="text/javascript" src="jquery.tablesorter.pager.js"></script>
        <script type="text/javascript">
            $(function() {
                $("table")
                .tablesorter({widthFixed: true, widgets: ['zebra']})
                .tablesorterPager({container: $("#pager")});
            });
        </script>
    </head>

    <body>
        <div id="main">
            <h1>Demo</h1>

            <!-- PHP code i开发者_JAVA百科n here -->

            <?php
                echo "test php";
            ?>

            <!--
                ...
                Main code for a table here
            -->
        </div>

    </body>
</html>


It sounds like you either don't have PHP installed or you're not using a file extension which invokes the PHP engine - is your file called Blah.php?

Some things to check:

  • You're serving the file from a web server (not locally)
  • The server has PHP installed
  • PHP is configured to handle the file type you're using (usually .php)
  • creating a new file with just <?php phpinfo(); ?> and serving it should give you lots of information about your PHP install.
  • If you have access to the server, you should be able to run PHP from the command line/shell
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜