Home  >  Article  >  Backend Development  >  How to use php to output hello world?

How to use php to output hello world?

coldplay.xixi
coldplay.xixiOriginal
2020-07-10 09:23:3220345browse

How to use php to output hello world: first create a new php file and place the php file on the server; then the compiler opens the created php file and enters [echo ("hello world!")] program; finally open it by accessing the php file on the wamp server.

How to use php to output hello world?

How to use php to output hello world:

1. First, we need to create a new php file, as follows Picture, of course, this php file cannot be directly interpreted by the browser. The php file must be placed on the server and accessed through network access to read the content of the php file. Here the editor uses wampserver integration. Environment, as shown below:

How to use php to output hello world?

2. Then the compiler used by the editor here is zend studio, and then use the compiler to open the created php file, and then we enter the first PHP program, there are two ways to write PHP program. Here we will introduce the first one, which contains the PHP program with , and then echo is similar to print in C language. This directly echoes ("hello world!" ), as shown below:

How to use php to output hello world?

3. Then access the php file by accessing the php file on the wamp server instead of opening the local php file, and then view the php program The effect is as shown below:

How to use php to output hello world?

4. In the php program, we can also add some html code. In the picture below, we add an h1 tag, as shown below:

How to use php to output hello world?

5. Then open the browser again to view. The html code in the php file can also be displayed normally, as shown below:

How to use php to output hello world?

6. Then we introduce the second way of writing php code. We first write code like , and then write the php code in the middle of the script. As shown below:

How to use php to output hello world?

7. Open the browser again and you can see that the php code using the script tag can also be displayed normally. In practice, the editor uses the first method to write Most of them are PHP codes, as shown below:

How to use php to output hello world?

Related learning recommendations: PHP programming from entry to proficiency

The above is the detailed content of How to use php to output hello world?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn