sync
This commit is contained in:
44
core.php
Normal file
44
core.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace API;
|
||||
|
||||
|
||||
foreach (glob("modules/$project_name/*.php") as $filename) { include_once $filename;
|
||||
}
|
||||
|
||||
$traits_array_= array();
|
||||
$traits_array = get_declared_traits();
|
||||
foreach ($traits_array as $key) {
|
||||
array_push($traits_array_, substr($key, 4));
|
||||
}
|
||||
$traits_name=implode(",", $traits_array_);
|
||||
|
||||
eval("
|
||||
namespace API;
|
||||
final class API
|
||||
{
|
||||
use $traits_name;
|
||||
private static \$instance;
|
||||
public static function getInstance(): self
|
||||
{
|
||||
if (null === static::\$instance) {
|
||||
static::\$instance = new static();
|
||||
}
|
||||
return static::\$instance;
|
||||
}
|
||||
}
|
||||
");
|
||||
|
||||
$api = API::getInstance();
|
||||
|
||||
$_POST = json_decode(file_get_contents('php://input'), true);
|
||||
if (isset($_POST)) {
|
||||
$params=$_POST['params'];
|
||||
$flag=$params['flag'];
|
||||
if (method_exists($api, $flag)) {
|
||||
call_user_func(array($api, $flag), $params);
|
||||
} else {
|
||||
header('Content-Type:text/html; charset=UTF-8', true, 301);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user