I have defined a project Admin, 1. the PHPcodeDEFAULT_LANG & gt; zh-cnLANG_AUTO_DETECT & gt; true is defined in the configuration file, which automatically detects language packs 2. create the zh-cn folder in the project's Lang folder 3. create common in the zh-ch folder. phpPHPcode template problems 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!