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


PHP go函数代码示例

本文整理汇总了PHP中go函数的典型用法代码示例。如果您正苦于以下问题:PHP go函数的具体用法?PHP go怎么用?PHP go使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: refer

 public function refer()
 {
     //获取系统菜单
     $menu = service('menu')->menus();
     $cur = current($menu);
     go(__ROOT__ . $cur['url']);
 }
开发者ID:houdunwang,项目名称:hdcms,代码行数:7,代码来源:Entry.php

示例2: run

 /**
  * 运行钓子
  *
  * @param $options
  */
 public function run(&$options)
 {
     //检测安装
     if (!file_exists(APP_PATH . 'Install/Lock.php')) {
         if (MODULE != 'Install') {
             go(__ROOT__ . '/index.php?m=Install&c=Index&a=index');
         }
     } else {
         if (session('user')) {
             //登录
             define('IS_LOGIN', true);
             //管理员
             define('IS_ADMIN', $_SESSION['user']['admin'] == 1);
             //超级管理员
             define('IS_SUPER_ADMIN', $_SESSION['user']['rid'] == 1);
             //站长
             define('IS_WEBMASTER', strtoupper($_SESSION['user']['username']) == strtoupper(C('WEB_MASTER')));
         } else {
             //登录
             define('IS_LOGIN', false);
             //管理员
             define('IS_ADMIN', false);
             //超级管理员
             define('IS_SUPER_ADMIN', false);
             //站长
             define('IS_WEBMASTER', false);
         }
         //加载插件
         $this->loadAddons();
     }
 }
开发者ID:suhanyujie,项目名称:spider,代码行数:36,代码来源:AppInitHook.class.php

示例3: index

 public function index()
 {
     if (site()->users()->count() > 0) {
         go(panel()->urls()->login());
     }
     if ($problems = installation::check()) {
         $content = view('installation/check', array('problems' => $problems));
     } else {
         $form = panel()->form('installation', array('language' => kirby()->option('panel.language', 'en')));
         $form->cancel = false;
         $form->save = l('installation.signup.button');
         $form->centered = true;
         foreach (panel()->languages() as $lang) {
             $form->fields()->get('language')->options[$lang->code()] = $lang->title();
         }
         $form->on('submit', function ($form) {
             try {
                 // fetch all the form data
                 $data = $form->serialize();
                 // make sure that the first user is an admin
                 $data['role'] = 'admin';
                 // try to create the new user
                 $user = panel()->site()->users()->create($data);
                 // store the new username for the login screen
                 s::set('username', $user->username());
                 // redirect to the login
                 go(panel()->urls()->login() . '/welcome');
             } catch (Exception $e) {
                 $form->alert($e->getMessage());
             }
         });
         $content = view('installation/signup', array('form' => $form));
     }
     return layout('installation', array('meta' => new Snippet('meta'), 'content' => $content));
 }
开发者ID:aoimedia,项目名称:kosmonautensofa,代码行数:35,代码来源:installation.php

示例4: __construct

 public function __construct($kirby, $dir)
 {
     static::$instance = $this;
     $this->kirby = $kirby;
     $this->site = $kirby->site();
     $this->roots = new Panel\Roots($dir);
     $this->urls = new Panel\Urls($kirby->urls()->index() . '/' . basename($dir));
     $this->load();
     // load all available routes
     $this->routes = array_merge($this->routes, require $this->roots->routes . DS . 'api.php');
     $this->routes = array_merge($this->routes, require $this->roots->routes . DS . 'views.php');
     // setup the blueprint root
     blueprint::$root = $this->kirby->roots()->blueprints();
     // setup the form plugin
     form::setup($this->roots->fields, $this->kirby->roots()->fields());
     // start the router
     $this->router = new Router($this->routes);
     // register router filters
     $this->router->filter('auth', function () use($kirby) {
         $user = $kirby->site()->user();
         if (!$user or !$user->hasPanelAccess()) {
             if ($user) {
                 $user->logout();
             }
             go('panel/login');
         }
     });
     // check for a completed installation
     $this->router->filter('isInstalled', function () use($kirby) {
         if ($kirby->site()->users()->count() == 0) {
             go('panel/install');
         }
     });
 }
开发者ID:DerZyklop,项目名称:gutesache.pxwrk.de,代码行数:34,代码来源:panel.php

示例5: lists

 public function lists()
 {
     if (!isset($_SESSION['user']['user_id'])) {
         go('Home/User/login');
     }
     //分配模板文件配置
     $tplData['title'] = "购物车";
     $tplData['css'] = "cart|order";
     View::with('tplData', $tplData);
     //购物车列表信息
     $cart = $_SESSION['cart'];
     $price = 0;
     foreach ($cart as $k => $v) {
         $cart[$k]['goods'] = Db::table('goods')->where('goods_id', $v['goods_id'])->first();
         $attrs = explode('-', $v['stock_attr']);
         foreach ($attrs as $key => $value) {
             $attrs[$key] = Db::table('goods_attr')->where('goods_attr_id', $value)->first();
             $attrs[$key]['attr_name'] = Db::table('shop_attr')->where('attr_id', $attrs[$key]['attr_id'])->pluck('attr_name');
         }
         $cart[$k]['attr'] = $attrs;
         $price += $v['goods_price'] * $v['buy_num'];
         //总价
     }
     View::with('cart', $cart);
     View::with('price', $price);
     //收货地址列表
     $address = new \Home\Model\Address();
     $addressData = $address->getAll();
     View::with('addressData', $addressData);
     // p($addressData);
     View::make($this->tpl . 'order.html');
 }
开发者ID:ChenHuaPHP,项目名称:ZOLshop,代码行数:32,代码来源:OrderController.php

示例6: checkAccess

 public function checkAccess()
 {
     //未登录
     if (!IS_LOGIN) {
         go(U("Member/Login/login"));
     }
     //状态
     if (!USER_STATE) {
         $this->error('帐号审核中...');
     }
     //锁定
     if (IS_LOCK) {
         $this->error('帐号已锁定...');
     }
     //管理员
     if (WEB_MASTER || IN_ADMIN) {
         return true;
     }
     //会员中心关闭
     if (C("MEMBER_OPEN") == 0) {
         $this->display("template/system/member_close.html");
         exit;
     }
     //邮箱验证
     if (C('MEMBER_EMAIL_VALIDATE') && $_SESSION['user_state'] == 0) {
         go(U('Member/Email/VaifyMail'));
     }
     return true;
 }
开发者ID:jyht,项目名称:v5,代码行数:29,代码来源:MemberAuthControl.class.php

示例7: logout

 public function logout()
 {
     if ($user = app::$site->user()) {
         $user->logout();
     }
     go('panel/login');
 }
开发者ID:kompuser,项目名称:panel,代码行数:7,代码来源:auth.php

示例8: logout

 public function logout()
 {
     if ($user = panel()->site()->user()) {
         $user->logout();
     }
     go(panel()->urls()->login());
 }
开发者ID:muten84,项目名称:luigibifulco.it,代码行数:7,代码来源:auth.php

示例9: get_info

 /**
  * 获取评论信息
  * @param $module      模型
  * @param $contentid   文章ID
  * @param $siteid      站点ID
  */
 function get_info($module, $contentid, $siteid)
 {
     list($module, $catid) = explode('_', $module);
     if (empty($contentid) || empty($catid)) {
         return false;
     }
     //判断栏目是否存在 s
     $CATEGORYS = getcache('category_content_' . $siteid, 'commons');
     if (!$CATEGORYS[$catid]) {
         return false;
     }
     //判断模型是否存在
     $this_modelid = $CATEGORYS[$catid]['modelid'];
     $MODEL = getcache('model', 'commons');
     if (!$MODEL[$this_modelid]) {
         return false;
     }
     $this->db->set_catid($catid);
     $r = $this->db->get_one(array('catid' => $catid, 'id' => $contentid), '`title`');
     $category = getcache('category_content_' . $siteid, 'commons');
     $model = getcache('model', 'commons');
     $cat = $category[$catid];
     $data_info = array();
     if ($cat['type'] == 0) {
         if ($model[$cat['modelid']]['tablename']) {
             $this->db->table_name = $this->db->db_tablepre . $model[$cat['modelid']]['tablename'] . '_data';
             $data_info = $this->db->get_one(array('id' => $contentid));
         }
     }
     if ($r) {
         return array('title' => $r['title'], 'url' => go($catid, $contentid, 1), 'allow_comment' => isset($data_info['allow_comment']) ? $data_info['allow_comment'] : 1);
     } else {
         return false;
     }
 }
开发者ID:ahmatjan,项目名称:huluphp,代码行数:41,代码来源:comment_api.class.php

示例10: __init

 public function __init()
 {
     if (empty($_SESSION['user'])) {
         go("Index/Index/index");
     }
     $this->db = M('upload');
 }
开发者ID:lililishuang,项目名称:hdcms,代码行数:7,代码来源:ContentUploadController.class.php

示例11: category

 public function category()
 {
     $mid = Q('mid', 0, 'intval');
     $cid = Q('cid', 0, 'intval');
     $cache = cache('category');
     if (!$mid || !$cid || !isset($cache[$cid])) {
         _404();
     }
     $cachetime = C('CACHE_CATEGORY') >= 1 ? C('CACHE_CATEGORY') : null;
     if (!$this->isCache()) {
         $category = $cache[$cid];
         //外部链接,直接跳转
         if ($category['cattype'] == 3) {
             go($category['cat_redirecturl']);
         } else {
             $Model = ContentViewModel::getInstance($category['mid']);
             $catid = getCategory($category['cid']);
             $category['content_num'] = $Model->join()->where("cid IN(" . implode(',', $catid) . ")")->count();
             $category['comment_num'] = intval(M('comment')->where("cid IN(" . implode(',', $catid) . ")")->count());
             $this->assign("hdcms", $category);
             $this->display($category['template'], $cachetime);
         }
     } else {
         $this->display(null, $cachetime);
     }
 }
开发者ID:jyht,项目名称:v5,代码行数:26,代码来源:IndexControl.class.php

示例12: checkAdminAccess

 /**
  * 后台权限验证
  *
  * @return bool
  */
 protected function checkAdminAccess()
 {
     //没登录或普通用户
     if (!IS_ADMIN) {
         go("Login/login");
     }
     /**
      * 超级管理员与站长不受限制
      */
     if (IS_SUPER_ADMIN || IS_WEB_MASTER) {
         return true;
     }
     /**
      * 普通管理员权限检查
      */
     $nodeModel = M("node");
     $nodeModel->where = array("MODULE" => MODULE, "controller" => CONTROLLER, "action" => ACTION, 'type' => 1);
     $node = $nodeModel->field("nid")->find();
     /**
      * 当节点不存时,表示不需要验证
      * 这时直接允许操作
      */
     if (!$node) {
         return true;
     } else {
         $map['nid'] = $node['nid'];
         $map['rid'] = $_SESSION['user']['rid'];
         return M('access')->where($map)->find();
     }
 }
开发者ID:suhanyujie,项目名称:spider,代码行数:35,代码来源:AuthController.class.php

示例13: __construct

 public function __construct()
 {
     if (!session('user')) {
         go('Login/login');
     }
     parent::__construct();
 }
开发者ID:lililishuang,项目名称:hdcms,代码行数:7,代码来源:AuthController.class.php

示例14: __construct

 public function __construct()
 {
     if (!$_SESSION['user_id']) {
         go('Login/index');
     }
     parent::__construct();
 }
开发者ID:ChenHuaPHP,项目名称:ZOLshop,代码行数:7,代码来源:Controller.php

示例15: login

 public function login()
 {
     if (session('aid')) {
         go("Index/index");
     }
     if (IS_POST) {
         $username = Q("post.username");
         //对登录帐号的验证
         if (!($user = $this->_db->where("username='{$username}'")->find())) {
             $this->error('帐号输入错误');
         }
         //对密码的验证
         if ($user['password'] != md5($_POST['password'])) {
             $this->error('密码输入错误');
         }
         //当帐号密码输入正确时记录登录状态
         $_SESSION['aid'] = $user['aid'];
         $_SESSION['username'] = $user['username'];
         //跳转到后台界面
         go('Index/index');
     } else {
         //显示登录界面
         $this->display();
     }
 }
开发者ID:jyht,项目名称:v5,代码行数:25,代码来源:LoginControl.class.php


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