public function actionXml() { header('Content-Type: application/xml; charset=utf-8'); AppApi::setDataFormat(AppApi::FORMAT_XML); $api = new AppApi(); $api->run(); }
$user->mail = null; $user->first_name = null; $user->last_name = null; $user->homepage = null; $user->company = null; if ($auth) { $user->id = (int) $auth->id; $user->role = (int) $auth->role; $user->mail = $auth->mail; $user->first_name = $auth->first_name; $user->last_name = $auth->last_name; $user->homepage = $auth->homepage; $user->company = $auth->company; } // Api init $api = new AppApi($model, $cfg, $user); // Home page if ($route->match('home', null)) { $modules = $model->modulesAll(array('verified' => 1, 'active' => 1), 4); // var_dump(Ut::user()); // var_dump(Ut::formData('mail')); // $form->mail = Ut::formData('mail'); } elseif ($route->match('login', null)) { $view->view = 'login'; } elseif ($route->match('help', null)) { $view->view = 'help'; } elseif ($route->match('login/post', 2)) { // Check post if (!$_POST) { Ut::redirectTo(Ut::uri('report'), array('404 Page not found')); }
public static function setDataFormat($format) { $format = strtolower(trim($format)); if (in_array($format, self::$_formats)) { self::$_format = $format; return true; } else { throw new ApiException('format 参数错误', ApiError::FORMAT_INVALID); } }