Application/Common/conf/
下新建 tags.php
文件,增加内容如下:<?php
return array(
'app_begin' =>array('Behavior\CheckLangBehavior')
);
Application/Common/conf/config.php
配置文件中新增如下内容:<?php
'LANG_SWITCH_ON' => true, // 开启语言包功能
'LANG_AUTO_DETECT' => true, // 自动侦测语言 开启多语言功能后有效
'LANG_LIST' => 'zh-cn,en-us', // 允许切换的语言列表 用逗号分隔
'VAR_LANGUAGE' => 'l', // 默认语言切换变量
Application/Common/
下新建 Lang
目录。Application/Common/Lang/
下新建 en-us.php
文件,增加内容如下:<?php
return array(
'EDIT'=>'edit',
);
Application/Common/Lang/
下新建 zh-cn.php
文件,增加内容如下:<?php
return array(
'EDIT'=>'编辑',
);
{$Think.lang.EDIT}
或者{:L('EDIT')}
<a href="?l=zh-cn" >简体中文</a> | <a href="?l=en-us" >English</a>
(完)
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有