Hello World

'; ?>" and save it; finally Just open the address of the web server in your browser."/> Hello World

'; ?>" and save it; finally Just open the address of the web server in your browser.">

Home  >  Article  >  Backend Development  >  How to write a web page using php

How to write a web page using php

angryTom
angryTomOriginal
2019-11-02 11:15:0914179browse

How to write a web page using php

How to write a web page using php

Create a file named index.php in the root directory of the web server file, and then complete the following content:

<html>
 <head>
  <title>第一个php网页</title>
 </head>
 <body>
 <?php echo &#39;<p>Hello World</p>&#39;; ?>
 </body>
</html>

Enter the URL of the web server in the browser's address bar to access this file. If you develop locally, this URL is usually http://localhost/index.php or http://127.0.0.1/index.php, of course, this depends on the web server settings. If all settings are correct, then this file will be parsed by PHP, and the following results will be output in the browser:

Hello World

Right-click to view the source code and the following code will appear

<html>
 <head>
  <title>第一个php网页</title>
 </head>
 <body>
 <p>Hello World</p>
 </body>
</html>

This program It's very simple, it just uses PHP's echo statement to display Hello World. Note that this file does not need to be executed or specified in any way. The server will find the file and provide it to PHP for interpretation because the ".php" extension is used. The server has been configured to automatically pass files with a ".php" extension to PHP. An ordinary HTML file, with a few special tags added, can do a lot of very interesting things!

Now you can try to replace e60a2397137d10f1d0f304a3671ebb27Hello World94b3e26ee717c64999d7867364b1b4a3'; ?> with the following code, and then open the browser to take a look.

<?php phpinfo(); ?>

For more PHP related knowledge, please visit PHP Chinese website!

The above is the detailed content of How to write a web page using php. 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