Improve params.
This commit is contained in:
parent
255ef0a75d
commit
b07333f3c8
@ -13,6 +13,10 @@ class Params {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function __isset($index) {
|
||||||
|
return isset($this->data[$index]);
|
||||||
|
}
|
||||||
|
|
||||||
public function __get($index){
|
public function __get($index){
|
||||||
return (isset($this->data[$index]) && $this->data[$index] != '') ? $this->data[$index] : null;
|
return (isset($this->data[$index]) && $this->data[$index] != '') ? $this->data[$index] : null;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Libs;
|
namespace Libs;
|
||||||
|
|
||||||
use Libs\Request;
|
use Libs\Request;
|
||||||
@ -119,15 +120,17 @@ class Router{
|
|||||||
if (isset($router['middleware'])){
|
if (isset($router['middleware'])){
|
||||||
$middleware = explode('::',$router['middleware']);
|
$middleware = explode('::',$router['middleware']);
|
||||||
$data = call_user_func_array($middleware, [$router['callback'], $args, $params]);
|
$data = call_user_func_array($middleware, [$router['callback'], $args, $params]);
|
||||||
}else
|
} else {
|
||||||
$params[] = $args;
|
$params[] = $args;
|
||||||
$data = call_user_func_array($router['callback'], $params);
|
$data = call_user_func_array($router['callback'], $params);
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
if (isset($router['middleware'])){
|
if (isset($router['middleware'])){
|
||||||
$middleware = explode('::',$router['middleware']);
|
$middleware = explode('::',$router['middleware']);
|
||||||
$data = call_user_func_array($middleware, [$router['callback'], $args]);
|
$data = call_user_func_array($middleware, [$router['callback'], $args]);
|
||||||
}else
|
} else {
|
||||||
$data = call_user_func_array($router['callback'], [$args]);
|
$data = call_user_func_array($router['callback'], [$args]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($data)){
|
if (isset($data)){
|
||||||
|
Loading…
Reference in New Issue
Block a user