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){
|
||||
return (isset($this->data[$index]) && $this->data[$index] != '') ? $this->data[$index] : null;
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace Libs;
|
||||
|
||||
use Libs\Request;
|
||||
@ -119,16 +120,18 @@ class Router{
|
||||
if (isset($router['middleware'])){
|
||||
$middleware = explode('::',$router['middleware']);
|
||||
$data = call_user_func_array($middleware, [$router['callback'], $args, $params]);
|
||||
}else
|
||||
} else {
|
||||
$params[] = $args;
|
||||
$data = call_user_func_array($router['callback'], $params);
|
||||
}
|
||||
}else{
|
||||
if (isset($router['middleware'])){
|
||||
$middleware = explode('::',$router['middleware']);
|
||||
$data = call_user_func_array($middleware, [$router['callback'], $args]);
|
||||
}else
|
||||
} else {
|
||||
$data = call_user_func_array($router['callback'], [$args]);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($data)){
|
||||
header('Content-Type: application/json');
|
||||
|
Loading…
Reference in New Issue
Block a user