菜单
  

    The I mpor tance of the I nstr uction Ter minator.The instruction terminator, also known as the semicolon (;), is absolutely required at the end of commands. The instruction terminator tells the PHP parser, "I'm done with this command, try the next one."
    If you do not end commands with a semicolon, the PHP parser will become confused, and your code will display errors. These next steps show you how these errors come about and, more importantly, how to fix them.
    1. Open a new file in your text editor.
    2. Type the following HTML:
    <HTML>
    <HEAD>
    <TITLE>Making an Error</TITLE>
    </HEAD>
    <BODY>
    3. Type the following PHP code:
    <?
    echo "<P>I am trying to produce an error</P>"
    echo "<P>Was I successful?</P>";
    ?>
    4. Add some more HTML so that the document is valid:
    </BODY>
    </HTML>
    5. Save the file with the name errorscript.php.
    6. Place this file in the document root of your web server.
    7. Open your web browser and type http://127.0.0.1/er r or scr ipt.php.
    What a nasty error! The error message says that the error is on line 8. Take a look at lines 7 and 8 of the script:
    echo "<P>I am trying to
    produce an error</P>"
    echo "<P>Was I
    successful?</P>";
    Line 7 does not have an instruction terminator, and line 8 starts a new command. The PHP parser doesn't like this, and it tells you so by producing the parse error.
     
    This error is easy enough to fix:
    1. Open the errorscript.php file.
    2. On line 7, add the instruction terminator (;) to the end of the line:
    echo "<P>I am trying to produce an error</P>";
    3. Save the file.
    4. Place this file in the document root of your web server.
    5. Open your web browser and type http://127.0.0.1//er r or scr ipt.php.
     
    After you fix line 7, the PHP parser can deal with the file, and the rest of the output is successful. Avoid this and other errors by paying close attention to things such as semicolons and, as you'll learn in the next section, quotation marks!
     
    Julie C. Melni,《PHP 5 Fast & Easy Web Development》,Course Technology ,2004,P40-P50
    PHP和HTML混合
       PHP解析器识别一些类型的PHP开始和结束标签。它将尝试执行任何这些标记之间,所以它最好是有效的代码!
    学习研究表4.1中被PHP解析器的三个主要的开始和结束标记。
     
      接下来,您将使用所有三套标签在脚本中,我承诺将执行没有错误。
    1.在你的文本编辑器,打开一个新文件。
    2. 输入以下代码,使用第一个标记类型:
        <?php
         echo "<P>This is a test using the first tag type.</P>";
         ?>
    Type the following code, which uses the second tag type:

        <?
        echo "<P>This is a test using the second tag type.</P>";
        ?>

    4.输入以下代码,使用第三个标签类型:
          <script language="php">
        echo "<P>This is a test using the third tag type.</P>";
        </script>
    5. 保存文件的名称为phptags.php。
    6.在网页服务器根目录文件夹中建立这个文档。
    7.打开浏览器并输 http://127.0.0.1/phptags.php。
     
      在您的web浏览器中,您应该看到脚本的结果。
      在下一节中,您将了解,将PHP块内部HTML并不是一件可怕的事情。
    Mixing PHP and HTML
    代码融合
  1. 上一篇:注射成型模具残余应力英文文献和中文翻译
  2. 下一篇:JSP的优点英文文献和中文翻译
  1. 汽车乘员舱的声振耦合英文文献和中文翻译

  2. 立体光照成型的注塑模具...

  3. 数控机床英文文献和中文翻译

  4. 工业机械手英文文献和中文翻译

  5. 低频振动的铁路车轴的状...

  6. 接头的形状对沥青塞接头...

  7. 数控加工技术英文文献和中文翻译

  8. 电站锅炉暖风器设计任务书

  9. 河岸冲刷和泥沙淤积的监测国内外研究现状

  10. 酸性水汽提装置总汽提塔设计+CAD图纸

  11. 中考体育项目与体育教学合理结合的研究

  12. 十二层带中心支撑钢结构...

  13. java+mysql车辆管理系统的设计+源代码

  14. 大众媒体对公共政策制定的影响

  15. 当代大学生慈善意识研究+文献综述

  16. 乳业同业并购式全产业链...

  17. 杂拟谷盗体内共生菌沃尔...

  

About

751论文网手机版...

主页:http://www.751com.cn

关闭返回