PHP 基础知识

PHP("PHP: Hypertext Preprocessor",超文本预处理器的字母缩写)是一种被广泛应用的开放源代码的多用途脚本语言,它可嵌入到 HTML 中,尤其适合 WEB 开发。

<html>
<head>
    <title>Example</title>
</head>
<body>
    <?
        php echo "Hi, I'm a PHP script!";
    ?>
</body>
</html>
1. <?php echo("if you want to serve XHTML or XML documents, do like this\n"); ?>
2. <? echo ("this is the simplest, an SGML processing instruction\n"); ?>
   <?= expression ?> This is a shortcut for "<? echo expression  ?>" ?>

3. <script language="php" runat=server>
      echo ("some editors (like FrontPage) don't
      like processing instructions");
   </script>

4. <% echo ("You may optionally use ASP-style tags"); %>
   <%=$variable; %>

注意: