コード例 #1
0
ファイル: HttpServer.php プロジェクト: boofw/phpole
 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);
 }
コード例 #2
0
ファイル: Response.php プロジェクト: boofw/phpole
 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>';
 }
コード例 #3
0
ファイル: Validator.php プロジェクト: boofw/phpole
 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);
 }
コード例 #4
0
ファイル: helpers.php プロジェクト: boofw/phpole
 function old($k, $default = '')
 {
     return \Boofw\Phpole\Http\Input::old($k, $default);
 }