ThinkPHP学习笔记多模板支持和多语言支持
首先是多模板支持:
需要在tpl上面新建red文件夹和对应的action的html模板
conf.php
//多模板支持
'TMPL_SWITCH_ON'=>true,
'TMPL_DETECT_THEME'=>true,
index.html
多语言支持:
confg.php
[php]
//多语言支持
//是否开启多语言支持
'LANG_SWITCH_ON'=>true,
//安照Lang下的文件夹名称来写
'DEFAULT_LANG'=>'zh-cn',
//自动侦测语言
'LANG_AUTO_DETECT'=>true,
创建对应的文件夹语言包,所有action公共的命名为common.php,针对不同的action命名为不同的php文件;比如user.php
common代码:
[php]
/**
* 针对全局的模块定义的中文文件
* 一:模板需要修改
* 二:配置文件需要修改
*
*/
return array(
'welcome'=>'welcome',
'lan'=>'english',
'usernamenull'=>'username is null',
);
?>
设置语言方式一在common中设置
设计语言方式二:在Action中设置,使用L函数
[php]
//快捷设置语言
L('demo','多语言测试');
在页面引用并更换文字
[html] www.2cto.com
欢迎:
语言:
demo:
在Model中设置使用语言的方式:;需要加上前导符
如,在model中设置提示验证信息
[php]
protected $_validate=array(
//在模型中添加国际化
array('username','require','',0,0,1),
array('username','checklen','用户名长度不合法',0,'callback',3),
array('password','require','用户名必填',0,0,1),
array('repassword','require','用户名必填',0,0,1),
array('password','repassword','密码不一致',0,'confirm',1),
/ array('createip','email','邮箱格式不对',0,'regex',1),
);

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Hello everyone, I am your old friend, a friend who talks to you about the crypto market in Binance Plaza all year round. Binance Launchpool recently launched the 64th phase project - RedStone (RED). As a multi-chain oracle project, it sparked a lot of discussion before it was launched. Today we will have an in-depth analysis of RED to see how its potential and how the price may go after it is launched. Binance Launchpool No. 64 project analysis and price forecast: Can RedStone (RED) ignite the market? Project background and core highlights RedStone (RED) is a multi-chain oracle platform focusing on decentralized finance (DeFi), with the goal of E

Web3 Vertical AIAgent: Subvert tradition and reshape the industry landscape? This paper discusses the application differences of AIAgent in Web2 and Web3 and the future potential of Web3Agent. Web2 has been widely used to improve efficiency, covering sales, marketing and other fields, and has achieved significant economic benefits. Web3Agent combines blockchain technology to open up new application scenarios, especially in the DeFi field. It demonstrates potential beyond Web2Agent through token incentives, decentralized platforms and on-chain data analysis. Although Web3Agent is currently facing challenges, its unique advantages make it expected to compete with Web2 in the medium and long term, and even reshape the industry landscape. Web2AI

Artificial intelligence agents (AIAgents) are rapidly integrating into daily operations of enterprises, from large companies to small businesses, almost all areas have begun to be used, including sales, marketing, finance, law, IT, project management, logistics, customer service and workflow automation. We are moving from an era of manual processing of data, performing repetitive tasks, and using Excel tables to an era of autonomous operation by AI agents around the clock, which not only improves efficiency but also significantly reduces costs. Application case of AI agents in Web2: YCombinator's Perspective Apten: A sales and marketing optimization tool combining AI and SMS technology. BildAI: A model that can read architectural blueprints,

According to The Information, Citigroup, the third largest asset-scale bank in the United States, is actively exploring the integration of cryptocurrency custody services into its business territory. It is reported that Citi's move originated from a pilot project launched in February 2024 that successfully demonstrated the feasibility of issuing and custodializing tokenized private equity funds on the blockchain network. Many banks have obtained digital asset custody licenses. At present, many banks have obtained digital asset custody service qualifications in different countries/regions. For example, BNY Mellon has been approved to provide digital asset custody services other than Bitcoin and Ethereum ETFs; Standard Chartered has established a foundation for digital asset custody in Dubai.

This time, the Redstone token $RED will be launched on Binance Launchpool on Binance TGE! This is also the first time Binance has launched a pre-market trading limit mechanism! The first day limit is 200%, and the ban will be lifted after 3 days to avoid "the peak will be achieved when the market opens"! Launchpool mechanism introduces the BinanceLaunchpool participating in Redstone that needs to pledge designated tokens (BNB, USDC, FDUSD) activity period is 48 hours: 08:00 UTC on February 26, 2025 to 08:00 UTC on February 28, 2025 ending this pre-market daily limit rule: 18:00 on February 28, 2025

The possible price increase of Dogecoin ETF after approval is 2 to 5 times, and the current price of $0.18 may rise to $0.6 to $1.2. 1) In the optimistic scenario, the increase can reach 3 times to 10 times, due to the bull market and the boost of Musk; 2) In the neutral scenario, the increase is 1.5 times to 3 times, due to moderate capital inflows; 3) In the pessimistic scenario, the increase is 0.5 times to 1.5 times, due to bear market and low liquidity.

In-depth analysis of the 64th issue of Launchpool project RED: Modular oracle prospects and currency price predictions This article deeply analyzes the 64th issue of Launchpool project RED - a multi-chain oracle project across EVM and non-EVM chains, and makes reasonable estimates of the project fundamentals and currency price. The RED project was launched for only 2 days, with the total volume of Launchpool being 40,000,000RED (accounting for 4% of the maximum supply of tokens), and the initial circulation was 280,000,000RED (accounting for 28% of the total supply of tokens). Project Overview: RedStone is a modular blockchain oracle founded in 2020 and incubated by Arweave Chain with the team from Estonia. Currently supports 70 chains

In-depth interpretation of Binance rookie RedStone (RED): Price forecast, risk and opportunity This article deeply analyzes Binance's latest online project RedStone (RED), to explore its price trend, potential risks and future development prospects, and provide reference for investors. Key points: The initial price of RedStone (RED) is expected to be between $0.20 and $0.30, but the market is volatile. RedStone is a mature modular blockchain oracle that operates since 2021, supports more than 70 blockchains and more than 1,250 assets, and raises US$22 million. The total supply of REDs is 1 billion pieces, and the listing circulation is 28%. The future price is affected by project application rate and market sentiment.
