Merge pull request #172 from skipperbent/v2

V2
This commit is contained in:
Simon Sessingø
2016-11-21 09:04:32 +02:00
committed by GitHub
2 changed files with 7 additions and 1 deletions
+5
View File
@@ -402,6 +402,11 @@ url('phones.edit');
# /phones/edit/
```
**Return the current url**
```php
url();
```
## Custom CSRF verifier
Create a new class and extend the ```BaseCsrfVerifier``` middleware class provided with simple-php-router.
+2 -1
View File
@@ -396,7 +396,8 @@ class Router
/* Return current route if no options has been specified */
if ($name === null && $parameters === null) {
return '/' . trim(parse_url($this->request->getUri(), PHP_URL_PATH), '/') . $this->arrayToParams($getParams);
$url = rtrim(parse_url($this->request->getUri(), PHP_URL_PATH), '/');
return (($url === '') ? '/' : $url . '/') . $this->arrayToParams($getParams);
}
/* If nothing is defined and a route is loaded we use that */