ThinkPHP数据模板展示——系统变量、常量、配置文件

WBOY
Release: 2016-06-13 12:12:36
Original
819 people have browsed it

ThinkPHP数据模板显示——系统变量、常量、配置文件

二、系统变量输出

普通的模板变量需要首先赋值后才能在模板中输出,但是系统变量则不需要,可以直接在模板中输出,系统变量的输出通常以 {$Think打头,eg:

{$Think.server.script_name}   //输出$_SERVER['SCRIPT_NAME']变量{$Think.session.user_id}      //输出$_SESSION['user_id']变量{$Think.get.pageNumber}       //输出$_GET['pageNumber']变量{$Think.cookie.name}          //输出$_COOKIE['name']变量
Copy after login

?支持输出 $_SERVER, $_ENV, $_POST, $_GET, $_REQUEST, $_SESSIOIN 和$_COOKIE变量

三、常量输出

1.系统常量

输出常量:{$Think.const.MODULE_NAME}或者	:{$Think.MODULE_NAME}
Copy after login

?2.在控制器中自定义常量并输出

控制器:	const PAI = 3.14;  		$this->assign("pai",self::PAI);		$this->display();模板 : 	{$pai}
Copy after login

四、配置输出

首先,在配置文件中有定义,在模板文件中才可以直接调用输出

输出配置参数: {$Think.config.db_charset}		      {$Think.config.url_model}
Copy after login

??五、语言输出

输出语言变量: {$Think.lang.page_error}		      {$Think.lang.var_error}
Copy after login

?

?

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template