毕业论文

打赏
当前位置: 毕业论文 > 外文文献翻译 >

PHP和HTML混合英文文献和中文翻译(2)

时间:2019-07-20 16:46来源:毕业论文
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 p


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
代码融合 PHP和HTML混合英文文献和中文翻译(2):http://www.youerw.com/fanyi/lunwen_35973.html
------分隔线----------------------------
推荐内容