PHP涉及数据库内容的多语言设计如何实现?
请问有人做过么?(就类似APPLE的官网的内容多语言切换)能不能帮一下忙,谢谢了
——解决思路———————-
表中字段加多語言。
例如:
sc_title, en_title, tc_title
——解决思路———————-
语言改变不改动数据库的做法
table: res (id, …)
table: res_lang (id, res_id, 语言, 内容…)
——解决思路———————-
这个用法不需要增加表,以上
——解决思路———————-
不用加字段,也不用加标,这样设计表
我之前是这样做的:
<br />CREATE TABLE `article` (<br /> `id` int(10) unsigned NOT NULL AUTO_INCREMENT,<br /> `albumID` int(11) DEFAULT NULL,<br /> `category` mediumint(8) unsigned NOT NULL DEFAULT '0',<br /> `title` varchar(120) NOT NULL,<br /> `uid` int(10) unsigned NOT NULL DEFAULT '0', <br /> `description` mediumtext NOT NULL,<br /> `content` text NOT NULL, <br /> `puttime` i<mark>(本文来)源gaodaimacom搞#^代%!码&网(</mark><pre>搞gaodaima代码
nt(10) unsigned NOT NULL DEFAULT ‘0’,
`listorder` int(10) unsigned NOT NULL DEFAULT ‘999’,
`lang` varchar(20) NOT NULL DEFAULT ‘zh_cn’,
PRIMARY KEY (`id`),
KEY `category` (`category`),
KEY `lang` (`lang`)
) ENGINE=MyISAM AUTO_INCREMENT=5961 DEFAULT CHARSET=utf8
其中lang字段用来标识不同语言,所有语种的都保存到这个表