Home>Article>Backend Development> 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
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!