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


PHP G函数代码示例

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


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

示例1: display

 function display($templates = '', $path = '')
 {
     // 模板阵列变量分解成为独立变量
     if ($this->tVar) {
         extract($this->tVar, EXTR_OVERWRITE);
     }
     /*
      * 声明前台所需常量
      */
     if (!$this->isSetDefine) {
         define('TPL_PATH', APP_PATH . 'tpl/' . C('System', 'skin') . '/');
         define('PUBLIC_PATH', (G('main_path') ? SITE_PATH : WEB_PATH) . 'statics/' . C('System', 'skin') . '/');
         define('IMG_PATH', PUBLIC_PATH . 'images/');
         define('JS_PATH', PUBLIC_PATH . 'js/');
         define('CSS_PATH', PUBLIC_PATH . 'css/');
         define('LOCAL_PUBLIC_PATH', WEB_PATH . 'statics/' . C('System', 'skin') . '/');
         load('view.fun');
         $this->isSetDefine = true;
     }
     if (!$templates) {
         $templates = C('System', 'm');
     }
     if (!$path) {
         $path = C('System', 'c');
     }
     return include getTpl($templates, $path);
 }
开发者ID:sdgdsffdsfff,项目名称:51jhome_customerservice,代码行数:27,代码来源:action.class.php

示例2: mixConfig

 public function mixConfig($module)
 {
     $Conf['headers'] = $this->headers;
     $Conf['env'] = $this->env;
     //app 配置
     $con = array_merge($this->app, $this->moduleConfig);
     $con = array_merge($con, $this->ent);
     $con = array_merge($this->AppDefaultConfig, $con);
     $Conf['app'] = $con;
     //获取rules 配置
     $file = 'Rules.php';
     $fileb = $this->ent['APP_PATH'] . $file;
     $filep = $this->ent['APP_PATH'] . 'Modules/' . $this->app['modulelist'][$module] . '/' . $file;
     $rules = G($fileb);
     if ($module) {
         $rules_ = G($filep);
     }
     if (!empty($rules_)) {
         $access = array_merge($rules['access']['rules'], $rules_['access']['rules'] ?: []);
         unset($rules['access']['rules']);
         unset($rules_['access']['rules']);
         $rules = array_merge($rules, $rules_ ?: []);
         $rules['access']['rules'] = $access;
     }
     $Conf['rules'] = $rules;
     C($Conf);
     //        $Conf['ent'] = $this->ent;
     //        $Conf['AppDefaultConfig'] = $this->AppDefaultConfig;
     //        $Conf['moduleConfig'] = $this->moduleConfig;
     //        $Conf['app'] = $this->app;
     //        +app
     //        $Conf['modulelist'] = $this->modulelist;
     return true;
 }
开发者ID:shampeak,项目名称:_m.so,代码行数:34,代码来源:ConfigManager.php

示例3: show

 /**
  * 返回Ajax数据
  *
  */
 public function show()
 {
     header('Content-Type: application/json; charset=utf-8');
     $json = array('code' => $this->code, 'message' => $this->mess, 'data' => $this->data, 'time' => G('init', '_end', 3));
     $json = json_encode($json);
     exit($json);
 }
开发者ID:otkinlife,项目名称:MyPhalcon,代码行数:11,代码来源:webftp.php

示例4: V

function V($view)
{
    $view = ucfirst(strtolower($view)) . G('V_SUFFIX');
    require_once G('M_PATH') . $view . G('SUFFIX');
    $obj = new $view();
    return $obj;
}
开发者ID:xinxinz,项目名称:phpstudy,代码行数:7,代码来源:function.php

示例5: showTime

 /**
  * 显示运行时间、数据库操作、缓存次数、内存使用信息
  * @access private
  * @return string
  */
 private function showTime()
 {
     // 显示运行时间
     G('beginTime', $GLOBALS['_beginTime']);
     G('viewEndTime');
     $showTime = 'Process: ' . G('beginTime', 'viewEndTime') . 's ';
     if (C('SHOW_ADV_TIME')) {
         // 显示详细运行时间
         $showTime .= '( Load:' . G('beginTime', 'loadTime') . 's Init:' . G('loadTime', 'initTime') . 's Exec:' . G('initTime', 'viewStartTime') . 's Template:' . G('viewStartTime', 'viewEndTime') . 's )';
     }
     if (C('SHOW_DB_TIMES') && class_exists('Db', false)) {
         // 显示数据库操作次数
         $showTime .= ' | DB :' . N('db_query') . ' queries ' . N('db_write') . ' writes ';
     }
     if (C('SHOW_CACHE_TIMES') && class_exists('Cache', false)) {
         // 显示缓存读写次数
         $showTime .= ' | Cache :' . N('cache_read') . ' gets ' . N('cache_write') . ' writes ';
     }
     if (MEMORY_LIMIT_ON && C('SHOW_USE_MEM')) {
         // 显示内存开销
         $showTime .= ' | UseMem:' . number_format((memory_get_usage() - $GLOBALS['_startUseMems']) / 1024) . ' kb';
     }
     if (C('SHOW_LOAD_FILE')) {
         $showTime .= ' | LoadFile:' . count(get_included_files());
     }
     if (C('SHOW_FUN_TIMES')) {
         $fun = get_defined_functions();
         $showTime .= ' | CallFun:' . count($fun['user']) . ',' . count($fun['internal']);
     }
     return $showTime;
 }
开发者ID:tifaweb,项目名称:dswjshop,代码行数:36,代码来源:ShowRuntimeBehavior.class.php

示例6: showTpl

 public function showTpl($action)
 {
     G('viewStartTime');
     $templateFile = '';
     // 视图开始标签
     tag('view_begin', $templateFile);
     // 解析并获取模板内容
     if ($action == 'index' && strlen(tpl_path) == 32) {
         $tpl_arr = S('web_index_html_' . token);
         if (empty($tpl_arr)) {
             $tpl_arr = $this->web_get_tpl($action);
             S('web_index_html_' . token, $tpl_arr, 0);
         }
         $tpl_con = $tpl_arr['html'];
     } else {
         $tpl_arr = $this->web_get_tpl($action);
         $tpl_con = $tpl_arr['html'];
     }
     $content = $this->fetch('', $tpl_con);
     $content = str_replace('{pigcms:WEB_VISIT_URL}', 'http://' . now_host, $content);
     $content = str_replace('{pigcms:WEB_STATIC_URL}', $tpl_arr['static'], $content);
     // 输出模板内容
     $this->render($content);
     // 视图结束标签
     tag('view_end');
 }
开发者ID:hehekeke,项目名称:pigcms,代码行数:26,代码来源:View.class.php

示例7: __before

 public function __before()
 {
     G2_User::init();
     if (!G()->logged_in()) {
         $this->redirect(BASE_URL);
     }
 }
开发者ID:g2design,项目名称:g2-modules,代码行数:7,代码来源:crud.php

示例8: fbAuthen

function fbAuthen($redirect_uri)
{
    $code = G("code");
    $error = G("error");
    if (empty($code)) {
        header("Location: /");
        return;
    }
    if (empty($error)) {
        $token_url = "https://graph.facebook.com/oauth/access_token?client_id=" . FB_ID . "&redirect_uri=" . urlencode($redirect_uri) . "&client_secret=" . FB_SECRET . "&code=" . $code;
        $response = file_get_contents($token_url);
        $params = null;
        parse_str($response, $params);
        $acces_token = $params['access_token'];
        $_SESSION["FB_TOKEN"] = $acces_token;
    } else {
        $_SESSION["FB_TOKEN"] = "";
    }
    if ($redirect_uri === FB_CALLBACK_REGIS) {
        header("Location: /regis");
    } elseif ($redirect_uri === FB_CALLBACK_LOGIN) {
        header("Location: /login");
    } elseif ($redirect_uri === FB_CALLBACK_CONNECT) {
        header("Location: /setting/social");
    } else {
        header("Location: /");
    }
}
开发者ID:cloverink,项目名称:lotto,代码行数:28,代码来源:fb.php

示例9: nav_save

 function nav_save()
 {
     G2_User::init();
     if (G()->logged_in() && !empty($_POST)) {
         if (!empty($_POST['items']) && !empty($_POST['identity'])) {
             // Delete all current navigation details
             $navitems = R::findAll('navitem', 'identity=:id', ['id' => $_POST['identity']]);
             R::trashAll($navitems);
             foreach ($_POST['items'] as $new_item) {
                 $nav = R::dispense('navitem');
                 $nav->identity = $_POST['identity'];
                 $nav->label = $new_item['label'];
                 $nav->href = !$new_item['href'] ? null : $new_item['href'];
                 $nav->order = $new_item['order'];
                 //@todo parent node support
                 R::store($nav);
             }
             echo json_encode(['success' => true, 'message' => 'Content Saved Successfully']);
         } else {
             echo json_encode(['success' => false, 'message' => 'Data sent not correct']);
         }
     } else {
         echo json_encode(['success' => false, 'message' => 'Not Logged in']);
     }
     die;
 }
开发者ID:g2design,项目名称:g2-modules,代码行数:26,代码来源:ajax.php

示例10: optimal

 public function optimal()
 {
     ini_set('memory_limit', '1024M');
     set_time_limit(0);
     self::func_param_empty_check(array('n', 'k', 'j', 's'));
     $data = I('post.');
     $n = str_replace(" ", "", $data['n']);
     $nArray = explode(",", $n);
     $nCount = count($nArray);
     $k = $data['k'];
     $j = $data['j'];
     $s = $data['s'];
     if ($k < $j) {
         $this->error('k < j invalid input');
     }
     if ($j < $s) {
         $this->error('j < s invalid input');
     }
     if ($k < $s) {
         $this->error('k < s invalid input');
     }
     G('begin');
     $result = self::run($nArray, $nCount, $k, $j, $s);
     $totalSubSet = count($result);
     $strResult = 'Total cost time:' . G("begin", "end") . "s" . "<br/>" . ' Total optimal sub set: ' . $totalSubSet . '<br/>';
     foreach ($result as $key => $value) {
         $strResult = $strResult . '<br/>' . $value . '<br/>';
     }
     //        $fp = fopen('result.html',"rw");
     file_put_contents('result.html', 'n=' . $nCount . ' k=' . $k . ' j=' . $j . ' s=' . $s . ' .G("begin","end")."s".<br/>', FILE_APPEND);
     file_put_contents('result.html', $strResult, FILE_APPEND);
     session('result', $strResult);
     $this->redirect('index');
 }
开发者ID:edvardHua,项目名称:Optimal-Sample-Selection,代码行数:34,代码来源:IndexController.class.php

示例11: _initialize

 /**
  *
  */
 protected function _initialize()
 {
     G('begin');
     /* 读取站点配置 */
     //S('config',null);
     $config = S('config');
     if (empty($config)) {
         $config = config();
         S('config', $config, 86400);
     }
     C($config);
     $bbsinfo = S('bbsinfo');
     if (empty($bbsinfo)) {
         $bbsinfo = bbsinfo();
         S('bbsinfo', $bbsinfo, 86400);
     }
     if (C('WEB_LOCK') == '1') {
         exit("网站暂时关闭");
     }
     $userinfo = getuserinfo();
     if (empty($userinfo)) {
         $userinfo = null;
     }
     $listdata = S('listdata');
     if (empty($listdata)) {
         $listarticle = M('Article');
         $listdata = $listarticle->where('status = 0')->order('view')->limit(15)->getField('id,title,review');
         S('listdata', $listdata, 600);
     }
     $this->assign('listdata', $listdata);
     $this->assign('userinfo', $userinfo);
     $this->assign('bbsinfo', $bbsinfo);
 }
开发者ID:iixcai,项目名称:INBBS,代码行数:36,代码来源:HomeController.class.php

示例12: B

function B($a)
{
    if (C($a)) {
        $this->D($a);
    } elseif ($a instanceof E) {
        $a->F($this);
    } elseif (G($a)) {
    } elseif (H($a)) {
        I($a);
        foreach ($a as $b => $c) {
            if (J($b)) {
                if (!H($c) || !L('M', $c) || !L('O', $c)) {
                    throw new P('Q');
                }
                $d = isset($c['R']) ? $c['R'] : [];
                $b = $c['M'];
                $c = $c['O'];
            } elseif (H($c) && L('O', $c)) {
                $d = isset($c['R']) ? $c['R'] : [];
                $c = $c['O'];
            } else {
                $d = [];
            }
            $this->AB($b);
            $this->AC($d);
            $this->B($c);
            $this->AE();
        }
    } elseif (AF($a)) {
        throw new P('AH' . AI($a));
    }
}
开发者ID:exakat,项目名称:exakat,代码行数:32,代码来源:Ifthen.91.php

示例13: render_content

 function render_content($content, $layout = 'layouts/default.twig', $meta = '')
 {
     if (isset($_GET['disable_cache'])) {
         $_SESSION['disable_cache'] = true;
     }
     $this->pre_content = $content;
     $this->meta = $meta;
     $this->run_theme_script();
     $this->page->logged_in = $this->logged_in;
     $layout = $this->load_layout($layout, $this->theme);
     $content = $this->twig->render($layout->file, array_merge(self::$params, ['this' => &$this, 'layout_id' => $layout->getID()]));
     //Rather attach scripts and css here then in the template
     $c = Wa72\HtmlPageDom\HtmlPageCrawler::create($content);
     if (G()->logged_in()) {
         $this->attach_admin($c);
     }
     //		$this->replace_cdn_script_tags($c);
     $content = $c->saveHTML();
     if (!G()->logged_in() && empty($_POST)) {
         $this->cache_data($slug, $content);
     } else {
         $this->remove_cache($slug);
     }
     echo $content;
 }
开发者ID:g2design,项目名称:g2-modules,代码行数:25,代码来源:Loader.php

示例14: listen

 /**
  * 监听标签的插件
  * @param string $tag 标签名称
  * @param mixed $params 传入参数
  * @return void
  */
 public static function listen($tag, &$params = NULL)
 {
     if (isset(self::$tags[$tag])) {
         if (APP_DEBUG) {
             G($tag . 'Start');
             \System\Core\Error::trace('[ ' . $tag . ' ] --START--', '', 'INFO');
         }
         foreach (self::$tags[$tag] as $name) {
             APP_DEBUG && G($name . '_start');
             $result = self::exec($name, $tag, $params);
             if (APP_DEBUG) {
                 G($name . '_end');
                 \System\Core\Error::trace('Run ' . $name . ' [ RunTime:' . G($name . '_start', $name . '_end', 6) . 's ]', '', 'INFO');
             }
             if (false === $result) {
                 // 如果返回false 则中断插件执行
                 return;
             }
         }
         if (APP_DEBUG) {
             // 记录行为的执行日志
             \System\Core\Error::trace('[ ' . $tag . ' ] --END-- [ RunTime:' . G($tag . 'Start', $tag . 'End', 6) . 's ]', '', 'INFO');
         }
     }
     return;
 }
开发者ID:jayxtt999,项目名称:me,代码行数:32,代码来源:Hook.class.php

示例15: module_process

 function module_process(HtmlPageCrawler &$c)
 {
     $modules = $c->filter('module');
     foreach ($modules as $mod) {
         $mod_type = $mod->getAttribute('type');
         //Check if such a module exists
         $class = 'Theme_Module_' . ucfirst($mod_type);
         if (class_exists($class)) {
             //				echo $mod->getAttribute('id');
             $mod_ob = new $class($mod->getAttribute('id'), $this->page->id);
             /* @var $mod_ob Theme_Module_Interface */
             if (method_exists($mod_ob, 'set_module_xml')) {
                 $mod_ob->set_module_xml($c->filter('module[id="' . $mod->getAttribute('id') . '"]')->saveHTML());
             }
             $c->filter('module[id="' . $mod->getAttribute('id') . '"]')->replaceWith($mod_ob->render());
             if (method_exists($mod_ob, 'addCSS')) {
                 $c->filter('head')->append($mod_ob->addCSS());
             }
             if (method_exists($mod_ob, 'addJs')) {
                 $c->filter('body')->append($mod_ob->addJs());
             }
             if (G()->logged_in() && method_exists($mod_ob, 'load_admin')) {
                 $mod_ob->load_admin($c);
             }
         }
         //Add css for this module if not exists
         //Add js for this module if not exists
     }
 }
开发者ID:g2design,项目名称:g2-modules,代码行数:29,代码来源:LayoutProcess.php


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