In php multi-language settings, can I store multiple languages in the database or directly save them as an array file?

Source: Internet
Author: User
In php multi-language settings, whether to store an entry into the database or store this array in a unified lang. php file, which one is better? In php multi-language settings, whether to store an entry into the database or store this array in a unified lang. php file, which one is better?

Reply content:

In php multi-language settings, whether to store an entry into the database or store this array in a unified lang. php file, which one is better?

Database + Cache

Read the database directly in the development mode, and manage and delete the database in the production mode cache + background.

File format. Putting data in the database seriously affects the database load.

Determine the language based on the IP address or user selection.
For example, if a Chinese user accesses a login. php page, the language array/locale/zh_CN/login. php of the page is loaded by default:

/Locale/zh_CN/login. php
  'Login', 'username' => 'account', 'Password' => 'Password');/locale/en_US/login. php
  'Login', 'username' => 'username', 'Password' => 'Password');/Login. php
  

Appendix: Install GeoIP extension in PHP. Obtain information such as the visitor's country, city, and latitude and longitude Based on the IP address.

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.