https://github.com/dyazincahya-blog/simple-routing-with-php
An example how to make a rooting URL in PHP Language
https://github.com/dyazincahya-blog/simple-routing-with-php
example-code php php7 routing-example sample-code sample-php snippet
Last synced: 4 months ago
JSON representation
An example how to make a rooting URL in PHP Language
- Host: GitHub
- URL: https://github.com/dyazincahya-blog/simple-routing-with-php
- Owner: dyazincahya-blog
- License: mit
- Created: 2019-12-29T05:51:25.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-12-29T13:55:10.000Z (over 5 years ago)
- Last Synced: 2025-01-30T09:16:56.836Z (5 months ago)
- Topics: example-code, php, php7, routing-example, sample-code, sample-php, snippet
- Language: Hack
- Homepage: https://www.kang-cahya.com/2019/12/cara-membuat-routing-sederhana-di-pemrograman-php.html
- Size: 8.79 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Simple Routing With PHP
An example how to make a routing URL in PHP Language### Instalation
- Clone this repo ```git clone https://github.com/k4ng/simple-rooting-with-php.git```
- Move to htdocs
- Open ```index.php```
- Change path project dir ```/x-kang/simple-routing-with-php``` in variable ```$project_location```
- Done, You can try to access in your browser now :)### Sample Pages
- Home Page ```localhost/PROJECT_DIR/```
- About Page ```localhost/PROJECT_DIR/about```
- Contact Page ```localhost/PROJECT_DIR/contact```### Add And Remove PAGE
If you want to add or remove page you can added *new CASE* in this part code in ```index.php```
``` php
switch ($request) {
case $me.'/' :
require "views/home.php";
break;
case $me.'/about' :
require "views/about.php";
break;
case $me.'/contact' :
require "views/contact.php";
break;
default:
http_response_code(404);
echo "404";
break;
}
```### Author
[kang-cahya.com](https://www.kang-cahya.com/)### Source License
[MIT License](https://github.com/k4ng/simple-rooting-with-php/blob/master/LICENSE)