ThinkPHP functions: L method

Source: Internet
Author: User
L This method is used to set and obtain the current language definition when multiple languages are enabled. Call Format: L ('language variable '[, 'Language value']) L method is used to set and obtain the current language definition when multiple languages are enabled.
Call format: L ('language variable '[, 'Language value'])

Set language variables
In addition to defining language variables using language packs, we can use the L method to dynamically set language variables, for example:
  1. L ('Lang _ var', 'Language defination ');
The definition of the replication code language is case insensitive, so the following is equivalent:
  1. L ('Lang _ var', 'Language defination ');
We recommend that you use uppercase to define language variables.

L The method supports batch setting of language variables, for example:
  1. $ Lang ['Lang _ var1'] = 'language Definition 1 ';
  2. $ Lang ['Lang _ var2'] = 'language definition 2 ';
  3. $ Lang ['Lang _ var3'] = 'language definition 3 ';
  4. L ($ lang );
Copy the code to set the lang_var1 lang_var2 and lang_var3 language variables.
[-More-]
Get language variables
  1. $ LangVar = L ('Lang _ var ');
Copy the code or:
  1. $ LangVar = L ('Lang _ var ');
If the parameter is null, the code is copied to obtain all the currently defined language variables (including in the language definition file ):
  1. $ Lang = L ();
Copy the code or use it in the template.
  1. {$ Think. lang. lang_var}
Copy the code 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.