Added navigation and testing instructions
This commit is contained in:
parent
ee939f5c21
commit
47ce76fbb7
11
README.md
11
README.md
|
@ -16,5 +16,12 @@ Route::add('/user/(.*)/edit',function($id){
|
|||
});
|
||||
```
|
||||
|
||||
## Something dows not work?
|
||||
Dont forget to set the basepath in your index.php and .htaccess file.
|
||||
## Testing
|
||||
* Clone or download this repo
|
||||
* Cd into the repo folder and run:
|
||||
* ```php -S 0.0.0.0:8080```
|
||||
* Than open your Webbrowser and navigate to http://localhost:8080
|
||||
|
||||
## Something does not work?
|
||||
* Dont forget to set the basepath in your index.php and .htaccess file.
|
||||
* Enable mod_rewrite in your apache settings
|
||||
|
|
|
@ -53,7 +53,7 @@ class Route{
|
|||
// Add 'find string end' automatically
|
||||
$route['expression'] = $route['expression'].'$';
|
||||
|
||||
//echo $route['expression'].'<br/>';
|
||||
// echo $route['expression'].'<br/>';
|
||||
|
||||
// Check match
|
||||
if(preg_match('#'.$route['expression'].'#',self::$path,$matches)){
|
||||
|
|
13
index.php
13
index.php
|
@ -67,3 +67,16 @@ Route::add404(function($url){
|
|||
|
||||
// Check if any of the defined routes will match and execute them
|
||||
Route::run();
|
||||
|
||||
?>
|
||||
|
||||
<hr/>
|
||||
Navigation:
|
||||
<ul>
|
||||
<li><a href="/">home</a></li>
|
||||
<li><a href="/index.php">index.php</a></li>
|
||||
<li><a href="/user/3/edit">edit user 3</a></li>
|
||||
<li><a href="/foo/5/bar">foo 5 bar</a></li>
|
||||
<li><a href="/foo/bar/foo/bar">long route example</a></li>
|
||||
<li><a href="/test.html">test.html</a> (May not work with PHPs built in webserver. Try apache webserver.)</li>
|
||||
</ul>
|
||||
|
|
Loading…
Reference in New Issue
Block a user