Fix error on middleware set for DELETE method.
This commit is contained in:
parent
8a46d9a3c9
commit
831dd7ad47
@ -8,5 +8,3 @@ define('dbpass', '');
|
||||
|
||||
define('ROOT_DIR', __DIR__);
|
||||
?>
|
||||
|
||||
|
||||
|
@ -158,6 +158,19 @@ class Router {
|
||||
static::$last = ['post', count(static::$post)-1];
|
||||
return new static();
|
||||
}
|
||||
|
||||
/*
|
||||
* Define los routers para el método PUT.
|
||||
*
|
||||
* @param string $path
|
||||
* URI con pseudovariables
|
||||
*
|
||||
* @param function $callback
|
||||
* Función en formato Clase::Método que será llamada cuando la url y el método coincidan
|
||||
*
|
||||
* @return static
|
||||
* Devuelve un enlace estático
|
||||
*/
|
||||
|
||||
public static function put($path, $callback) {
|
||||
static::$put[] = static::parse($path, $callback);
|
||||
@ -179,14 +192,13 @@ class Router {
|
||||
*/
|
||||
public static function delete($path, $callback) {
|
||||
static::$delete[] = static::parse($path, $callback);
|
||||
static::$last = ['delete', count(static::$put)-1];
|
||||
static::$last = ['delete', count(static::$delete)-1];
|
||||
return new static();
|
||||
}
|
||||
|
||||
/*
|
||||
* Devuelve el URI path actual
|
||||
*/
|
||||
|
||||
public static function URIPath() {
|
||||
return preg_replace('/'.preg_quote(static::baseURI(), '/').'/',
|
||||
'/', strtok($_SERVER['REQUEST_URI'], '?'), 1);
|
||||
|
Loading…
Reference in New Issue
Block a user