public function jsonp($data, $param = 'jsonp', $code = 200, $encode = true) { $json = $encode ? json_encode($data) : $data; $callback = X::request()->query[$param]; $this->status($code)->header('Content-Type', 'application/javascript')->write($callback . '(' . $json . ');')->send(); }