PHPis a server-side scripting language that is easy to learn and use. With minimal programming knowledge, you can use PHP to build a truly interactive web site. This section of this article will let you familiarize yourself with PHP. I could not have done without any omission, and my purpose was only to allow you to quickly start your PHP programming.
I. First and foremost conditions
You first have to have a working Web server that supports PHP. I assume that all PHP files on your server have a. php3 extension.
Second, the installation of PHP
Generate a file named Test.php3 that contains the following:
-
Then open the file in your browser. Look at this page and you'll know the options for your PHP installation.
Third, grammar
As mentioned earlier, you can mix and write your PHP code and HTML code. So you have to have a way to differentiate between the two. Here are a few ways you can do it. You can choose one of the things that you are most comfortable with and stick to it this way!
Detach from HTML
Here are the methods you can use:
-
-
-
Statement
As with Perl and C, the statements are delimited in PHP (;). Flags that are separated from HTML also represent the end of the statement.
Comments
PHP supports c,c++ and UNIX-style annotation methods:
- /* c,c++ style multi-line Comment */
- C + + style line Comment
Example: hello,world!
With the knowledge that we have learned, you can write a simplest program output that is perhaps the most famous word in the program world:
- < HTML >
- < HEAD >
- < TITLE >
-
- Echo "Hello world!";
- ?>
-
TITLE >
-
HEAD >
- < BODY >
- < H1 >
- First PHP page
-
H1 >
- < HR >
-
- Single line C + + style Comment
- /*
- Printing the message
- */
- echo "Hello world!";
- # Unix Style single line comment
- ?>
-
BODY >
-
HTML >
1
http://www.bkjia.com/PHPjc/445779.html www.bkjia.com true http://www.bkjia.com/PHPjc/445779.html techarticle PHP is a server-side scripting language that is easy to learn and use. With minimal programming knowledge, you can use PHP to build a truly interactive web site. And this part of this article will let you to ...