找回密码
 注册加入

扫一扫,极速登录

QQ登录

只需一步,快速开始

搜索
查看: 2020|回复: 0

Discuz-X模板教程 G变量注解之 $_G['xxx'] 全局基本变量

[复制链接]
发表于 2011-9-27 20:58:05 | 显示全部楼层 |阅读模式
整理不容易,希望大家多多支持我们的版务工作,发现有违规行为及时到模板区版务管理中进行举报!



G变量的使用方法:
直接复制下面的变量放到模板需要的位置即可!
例如:$_G['style'][boardlogo] 刷新后就会 显示一张logo


全局变量系统篇

$_G['uid'] => 当前登录UID

$_G['username'] => 当前登录用户名

$_G['adminid'] => 当前登录ID管理组ID

$_G['groupid'] => 当前登录ID用户组ID

$_G['cookie'] => 客户端cookie

$_G['formhash'] => 当前登录ID的【FORMHASH】 主要用于表单提交

$_G['timestamp'] => 当前活动时间

$_G['starttime'] => 1317042440.3242

$_G['clientip'] => 当前访问者IP地址

$_G['referer'] => 当前请求的地址,主要用户表单提交

$_G['charset'] => 程序编码

$_G['PHP_SELF'] => 当前访问页面的相对地址

$_G['siteurl'] => 程序访问地址

$_G['siteroot'] => 程序所在域名的相对目录

$_G['fid'] => 当前版块id【主题列表页、帖子页】出现

$_G['tid'] => 当前帖子ID【帖子页】出现

$_G['basescript'] => 当前页面所在频道

$_G['basefilename'] => 当前页面php文件名

$_G['staticurl'] => 程序附件目录

$_G['mod'] => 当前页面的MOD值【例如:forum.php?mod=xxx】

$_G['inajax'] => 当前ajax请求的值【无-0 有-1】

$_G['page'] => 当前分页ID

$_G['tpp'] => 当前分页每页显示数量

$_G['seokeywords'] => 当前页面seo关键词

$_G['seodescription'] => 当前页面seo介绍

$_G['timenow'] => Array
(
    [time] => 2011-9-26 21:07 当前服务器时间
    [offset] => +8 当前服务器时区
)

$_G['config'] => Array
(
    $_G['config'][db] => Array
        (
            $_G['config'][db][1] => Array
                (
                    $_G['config'][db][1][dbhost] => localhost 数据库连接地址
                    $_G['config'][db][1][dbuser] => root 数据库用户名
                    $_G['config'][db][1][dbpw] => 123456 数据库密码
                    $_G['config'][db][1][dbcharset] => utf8 数据库编码
                    $_G['config'][db][1][pconnect] => 0
                    $_G['config'][db][1][dbname] => dxutf 数据库名
                    $_G['config'][db][1][tablepre] => pre_ 数据表前缀
                )
        )
)
您需要登录后才可以回帖 登录 | 注册加入  

本版积分规则

Archiver|手机版|小黑屋|Discuz!扩展中心 ( 浙ICP备14042422号-1 )|网站地图QQ机器人

GMT+8, 2024-4-29 10:28 , Processed in 0.260343 second(s), 11 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表