Discuz-X模板教程 G变量注解之 $_G['xxx'] 全局基本变量
整理不容易,希望大家多多支持我们的版务工作,发现有违规行为及时到模板区版务管理中进行举报!G变量的使用方法:
直接复制下面的变量放到模板需要的位置即可!
例如:$_G['style'] 刷新后就会 显示一张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
(
=> 2011-9-26 21:07 当前服务器时间
=> +8 当前服务器时区
)
$_G['config'] => Array
(
$_G['config'] => Array
(
$_G['config'] => Array
(
$_G['config'] => localhost 数据库连接地址
$_G['config'] => root 数据库用户名
$_G['config'] => 123456 数据库密码
$_G['config'] => utf8 数据库编码
$_G['config'] => 0
$_G['config'] => dxutf 数据库名
$_G['config'] => pre_ 数据表前缀
)
)
)
页:
[1]