Home >Backend Development >PHP Problem >How to use php to output hello world?
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:
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:
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:
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:
4. In the php program, we can also add some html code. In the picture below, we add an h1 tag, as shown below:
5. Then open the browser again to view. The html code in the php file can also be displayed normally, as shown below:
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:
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:
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!