简体   繁体   English

我的PHP代码只是我的html中的注释

[英]My PHP code is just a comment in my html

Sorry guys this is probably pretty simple, but i've been up way too late now. 对不起,伙计们这可能很简单,但我现在已经太晚了。 I have a basic html page with some javascript on it, and when i try to put any php in the body it reads it as a comment. 我有一个基本的html页面,上面有一些javascript,当我尝试将任何php放入正文时,它会将其作为注释读取。

    <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 in here

    <?php  
    echo "test php";
    ?>

...
main code for a table here
</div>
</body>
</html>

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 ? 听起来你要么没有安装PHP,要么你没有使用调用PHP引擎的文件扩展名 - 你的文件名为Blah.php吗?

Some things to check: 有些事要检查:

  • You're serving the file from a web server (not locally) 您是从Web服务器(不是本地)提供文件
  • The server has PHP installed 服务器已安装PHP
  • PHP is configured to handle the file type you're using (usually .php) PHP配置为处理您正在使用的文件类型(通常为.php)
  • creating a new file with just <?php phpinfo(); ?> <?php phpinfo(); ?>创建一个新文件<?php phpinfo(); ?> <?php phpinfo(); ?> and serving it should give you lots of info about your PHP install. <?php phpinfo(); ?>和服务就应该给你很多关于你的PHP安装信息的。
  • If you have access to the server, you should be able to run PHP from the command line/shell 如果您有权访问服务器,则应该能够从命令行/ shell运行PHP

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM