static function run() { if (self::makeToken($_SERVER['HTTP_PHPOLE_APPID']) !== $_SERVER['HTTP_PHPOLE_TOKEN']) { return json_encode(['error' => 'token验证失败']); } $r = call_user_func_array(array(new Native(Input::get('api')), Input::get('func')), json_decode(Input::get('arguments'), 1)); return json_encode($r); }
static function redirect($uri = null, $withInput = false, $flashData = []) { Session::reflash(); if ($withInput) { Input::flash(); } foreach ($flashData as $k => $v) { Session::flash($k, $v); } if (!$uri) { $uri = Request::referer(); } header('location: ' . $uri); return '<p>This page is moved to <a href="' . $uri . '">' . $uri . '</a></p>'; }
function __construct($rules, $values = null) { foreach ($rules as $field => $rule) { $this->rules[$field] = []; list($label, $rule) = explode('#', $rule); $checkers = explode('|', $rule); foreach ($checkers as $checker) { list($func, $params) = explode(':', $checker); $params = explode(',', $params); $this->rules[$field][$func] = compact('label', 'params'); } } if (!$values) { $values = Input::all(); } $this->values = array_intersect_key($values, $rules); }
function old($k, $default = '') { return \Boofw\Phpole\Http\Input::old($k, $default); }