thinkphp Development Framework function Detailed: L method

Source: Internet
Author: User
Keywords Development framework function L method thinkphp
Tags development development framework framework function get multilingual set use

The L method is used to set and get the current language definition when multilingual is enabled.
Call format: L (' language variable ' [, ' language value '])

Set Language variables

In addition to using language packs to define language variables, we can use the L method to dynamically set language variables, such as:

L (' Lang_var ', ' language definition '); The language definition is case-insensitive, so the following is equivalent: L (' Lang_var ', ' language definition ');
The L method supports the batch setting of language variables, for example:

$lang [' lang_var1 ']&http://www.aliyun.com/zixun/aggregation/37954.html ' >nbsp;= ' language definition 1 '; $lang [' lang_var2 '] = ' language definition 2 '; $lang [' lang_var3 '] = ' language definition 3 '; L ($lang);

Indicates that 3 language variables Lang_var1 lang_var2 and LANG_VAR3 are set at the same time.

Get language variables

$langVar = L (' Lang_var '); or: $langVar = L (' Lang_var '); If the argument is empty, it means get all the currently defined language variables (including those in the language definition file): $lang = L (), or we can use the {$ Think.lang.lang_var} to output the language definition.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.