Questions about ThinkPHP using the project Language Pack

Source: Internet
Author: User
I have defined a project Admin, 1. the configuration file defines PHPcode 'default _ LANG '= & gt; 'zh-cn' 'Lang _ AUTO_DETECT' = & gt; 'true', // automatically checks the Language Pack 2. create the zh-cn folder in the project's Lang folder 3. in the zh-ch folder, questions about using the project language pack for ThinkPHP
I have defined a project Admin,
1. the configuration file defines
PHP code

'Default _ lang' => 'zh-cn'
'Lang _ AUTO_DETECT '=> 'true', // automatically checks the language pack


2. create the zh-cn folder in the project's Lang folder.
3. create common. php in the zh-ch folder
PHP code

// Display part of the template file
Return array (
'_ Id' =>' number ',
'_ Name' => 'name ',
'_ Action' => 'operation ',
);



4. use in the template
PHP code

{: L ("_ ID ")}



But the display is "_ ID" instead of "ID". why?

------ Solution --------------------
The manual includes:
To set language-defined values in a program, use the following method:
L ('define2', 'Language defining ');
$ Value = L ('define2 ');

If you do not need to assign values to the output language variables in the template, you can directly use the special tags of the template engine to output the language-defined values:
{$ Think. lang. lang_var}
You can output the lang_var language definition defined in the selected language pack.


------ Solution --------------------
At the same time, you must clear the cache to make the new code take effect!

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.