Home>Article>Backend Development> php displays different pages based on address

php displays different pages based on address

angryTom
angryTom Original
2019-11-20 16:36:32 2656browse

php displays different pages based on address

php displays different pages according to the address

php displays different pages according to the url address. We can pass a The page parameter is implemented. The specific method is as follows:

1. Create a new index.php file and write the code

The above code means to determine whether there is a page parameter. And the page parameter is not empty. Then determine whether the page page file exists. If it exists, import it, otherwise 404 will be output.

2. Create a.php page and b.php page

3. Browser access test:

localhost/index.php?page=a localhost/index.php?page=b

php displays different pages based on address

php displays different pages based on address

php displays different pages based on address

php displays different pages based on address

For more PHP related knowledge, please visitPHP Chinese website!

The above is the detailed content of php displays different pages based on address. For more information, please follow other related articles on the PHP Chinese website!

php
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