当前位置: 首页>>代码示例>>PHP>>正文


PHP util::redirect方法代码示例

本文整理汇总了PHP中util::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP util::redirect方法的具体用法?PHP util::redirect怎么用?PHP util::redirect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在util的用法示例。


在下文中一共展示了util::redirect方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 public static function run()
 {
     if (!isset($_SERVER['REDIRECT_URL'])) {
         throw new Exception();
     }
     $_SERVER['REDIRECT_URL'] = substr($_SERVER['REDIRECT_URL'], strlen(config::prefix()));
     $path = explode('/', $_SERVER['REDIRECT_URL']);
     //array_shift($path);
     if ($path && preg_match('/^[0-9a-z]+$/i', $path[0])) {
         req::$controller = array_shift($path);
         if ($path && preg_match('/^[0-9a-z]+$/i', $path[0])) {
             req::$function = array_shift($path);
         }
     }
     unset($path);
     session::get_instance()->start();
     if (uuid::check(req::$controller)) {
         $obj = state::load(req::$controller);
         if (!$obj instanceof ctrl) {
             throw new Exception();
         }
         call_user_func(array($obj, req::$function));
     } else {
         $obj = eval('return new ' . req::$controller . '_ctrl();');
         if (!$obj instanceof ctrl) {
             throw new Exception();
         }
         util::redirect($obj, req::$function, $_GET);
     }
 }
开发者ID:RuschGaming,项目名称:twitch,代码行数:30,代码来源:engine.php

示例2: doSignIn

 public function doSignIn()
 {
     $prompt = null;
     $email = null;
     $password = null;
     if ($_POST) {
         $email = util::request("email", "P");
         $password = util::request("password", "P");
         if (empty($email)) {
             $prompt = "邮箱不能为空";
         } else {
             if (empty($password)) {
                 $prompt = "密码不能为空";
             } else {
                 $isOk = true;
                 //$this->load("user")->checkUser();
                 if ($isOk) {
                     util::redirect("http://cgi.daotianhudong.com/?c=admin&a=index");
                 } else {
                     $prompt = "用户名或密码错误";
                 }
             }
         }
     }
     $template = resource::getView('admin');
     $template->assign("prompt", $prompt);
     $template->assign("email", $email);
     $template->assign("password", $password);
     $template->display('signin.tpl');
 }
开发者ID:ChangAiQing,项目名称:framework_app,代码行数:30,代码来源:admin.php

示例3: post

 public function post()
 {
     try {
         $this->name->post();
         $this->pass->post();
         if ($this->name->value() == 'martin' && $this->pass->value() == 'test') {
             session_regenerate_id();
             $_SESSION['id'] = 1;
             util::redirect();
         } else {
             sleep(1);
             $this->message = '<p>Please check your username and password and try again.</p>';
             util::redirect($this, 'in');
         }
     } catch (Exception $e) {
         $this->message = $e->getMessage();
         util::redirect($this, 'in');
     }
 }
开发者ID:RuschGaming,项目名称:twitch,代码行数:19,代码来源:log_ctrl.php

示例4: doAuthorize

 /**
  * 授权
  * @return [type] [description]
  */
 public function doAuthorize()
 {
     $client_id = util::request("client_id", "G");
     $state = util::request("state", "G");
     $response_type = util::request("response_type", "G");
     $request = OAuth2\Request::createFromGlobals();
     $response = new OAuth2\Response();
     if (!$this->server->validateAuthorizeRequest($request, $response)) {
         $response->send();
         die;
     }
     if (!empty($_POST)) {
         $authorized = $_POST['authorized'] == 'yes';
         $this->server->handleAuthorizeRequest($request, $response, $authorized, "77777");
         if ($authorized) {
             $code = substr($response->getHttpHeader('Location'), strpos($response->getHttpHeader('Location'), 'code=') + 5, 40);
             //exit("SUCCESS! Authorization Code: $code");
             $clientInfo = $this->storage->getClientDetails($client_id);
             $redirect_uri = urldecode($clientInfo['redirect_uri']);
             //$url = $redirect_uri . "&code=" . $code . "&state=" . $state;
             $redirect_uri = util::add_url_param($redirect_uri, "code", $code);
             $redirect_uri = util::add_url_param($redirect_uri, "state", $state);
             util::redirect($redirect_uri);
         }
         //$response->send();
     }
     resource::getView('admin')->display("oauth_authorize.tpl");
 }
开发者ID:ChangAiQing,项目名称:framework_app,代码行数:32,代码来源:oauth.php

示例5: save

 protected function save()
 {
     $db = my_db::open();
     $db->set($this->id, 'acc', array('acc_id' => $this->acc_id->value(), 'name' => $this->name->value(), 'total' => $this->total));
     util::redirect('acc', 'load', array('id' => $this->id));
 }
开发者ID:RuschGaming,项目名称:twitch,代码行数:6,代码来源:acc_ctrl.php

示例6: post

 public function post()
 {
     $this->message = '';
     $this->name->post();
     $this->date->post();
     $this->total = 0;
     foreach ($this->entry as $entry) {
         $entry['acc_id']->post();
         $entry['amount']->post();
         $this->total += (double) $entry['amount']->value();
     }
     switch (key($_POST['action'])) {
         case 'set':
             break;
         case 'commit':
             // validate
             if (abs($this->total) < 0.01) {
                 if (count($this->entry) > 1) {
                     $ok = true;
                     foreach ($this->entry as $entry) {
                         if (abs($entry['amount']->value()) < 0.01) {
                             $ok = false;
                         }
                     }
                     if ($ok) {
                         $this->db = my_db::open();
                         $this->db->query('begin');
                         $this->id = $this->db->set($this->id, 'trn', array('name' => $this->name->value(), 'dte' => $this->date->value()));
                         $ids = array();
                         foreach ($this->entry as $entry) {
                             if ($entry['id']) {
                                 $ids[] = $entry['id'];
                             }
                         }
                         if ($ids) {
                             $this->db->query('delete from ent where trn_id=? and id not in (' . join(',', $ids) . ')', $this->id);
                         }
                         foreach ($this->entry as &$entry) {
                             $entry['id'] = $this->db->set($entry['id'], 'ent', array('trn_id' => $this->id, 'acc_id' => $entry['acc_id']->value(), 'amount' => $entry['amount']->value()));
                         }
                         unset($entry);
                         $this->db->query('commit');
                         util::redirect('trn', 'load', array('id' => $this->id));
                     } else {
                         $this->message = 'One or more entries has a balance of 0.00';
                     }
                 } else {
                     $this->message = 'There must be two or more entries to commit.';
                 }
             } else {
                 $this->message = 'Your total must be 0.00';
             }
             break;
         case 'cancel':
             util::redirect('secure');
         case 'remove':
             $i = key($_POST['action']['remove']);
             $this->total -= $this->entry[$i]['amount']->value();
             unset($this->entry[$i]);
             break;
         case 'add':
             $this->add_entry();
             break;
     }
     util::redirect($this);
 }
开发者ID:RuschGaming,项目名称:twitch,代码行数:66,代码来源:trn_ctrl.php


注:本文中的util::redirect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。