请问有人做过么?(就类似APPLE的官网的内容多语言切换)能不能帮一下忙,谢谢了
回复讨论(解决方案)
做过的大家都是怎么实现的一般?用字段?切换数据库?切换表?还是别的什么?
表中字段加多?言。
例如:
sc_title, en_title, tc_title
多语言界面,还是多语言内容?
表中字段加多?言。
例如:
sc_title, en_title, tc_title
这个做法是很不靠谱的,增加语言难道要增加字段吗?
语言改变不改动数据库的做法
table: res (id, ...)
table: res_lang (id, res_id, 语言, 内容...)
增加语言难道要增加表吗?
增加表就不是改动数据库了吗?
语言改变不改动数据库的做法
table: res (id, ...)
table: res_lang (id, res_id, 语言, 内容...)
增加语言难道要增加表吗?
增加表就不是改动数据库了吗?
语言改变不改动数据库的做法
table: res (id, ...)
table: res_lang (id, res_id, 语言, 内容...)
这个用法不需要增加表,以上
不用加字段,也不用加标,这样设计表
我之前是这样做的:
CREATE TABLE `article` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `albumID` int(11) DEFAULT NULL, `category` mediumint(8) unsigned NOT NULL DEFAULT '0', `title` varchar(120) NOT NULL, `uid` int(10) unsigned NOT NULL DEFAULT '0', `description` mediumtext NOT NULL, `content` text NOT NULL, `puttime` int(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字段用来标识不同语言,所有语种的都保存到这个表
增加字段或增加表,都可以轻松的将不同语种的内容关联在一起
如果自认为巧妙的用记录来保存,结果只是徒劳的增加访问的开销
增加字段或增加表,都可以轻松的将不同语种的内容关联在一起
如果自认为巧妙的用记录来保存,结果只是徒劳的增加访问的开销
这类数据99%要存到缓存里,这查询能增加多少开销?
你难道只是界面是多语的吗?
德文的界面中出现一篇日文的文章给谁看?
增加字段或增加表,都可以轻松的将不同语种的内容关联在一起
如果自认为巧妙的用记录来保存,结果只是徒劳的增加访问的开销
这类数据99%要存到缓存里,这查询能增加多少开销?
你难道只是界面是多语的吗?
德文的界面中出现一篇日文的文章给谁看?
增加字段或增加表,都可以轻松的将不同语种的内容关联在一起
如果自认为巧妙的用记录来保存,结果只是徒劳的增加访问的开销
这类数据99%要存到缓存里,这查询能增加多少开销?
奇怪,文章就不能缓存了?
具体采取哪种方案,要看产品需求
尽可能的复用公共的数据
比如只需求标题和内容多语言,图片共用,那就拆字段
如果不同语言发布的新闻完全不同,就分别独立成一条记录
如果模型都不一样,就考虑分表了
额,在这统一回复了,谢谢大家帮忙

ThesecrettokeepingaPHP-poweredwebsiterunningsmoothlyunderheavyloadinvolvesseveralkeystrategies:1)ImplementopcodecachingwithOPcachetoreducescriptexecutiontime,2)UsedatabasequerycachingwithRedistolessendatabaseload,3)LeverageCDNslikeCloudflareforservin

You should care about DependencyInjection(DI) because it makes your code clearer and easier to maintain. 1) DI makes it more modular by decoupling classes, 2) improves the convenience of testing and code flexibility, 3) Use DI containers to manage complex dependencies, but pay attention to performance impact and circular dependencies, 4) The best practice is to rely on abstract interfaces to achieve loose coupling.

Yes,optimizingaPHPapplicationispossibleandessential.1)ImplementcachingusingAPCutoreducedatabaseload.2)Optimizedatabaseswithindexing,efficientqueries,andconnectionpooling.3)Enhancecodewithbuilt-infunctions,avoidingglobalvariables,andusingopcodecaching

ThekeystrategiestosignificantlyboostPHPapplicationperformanceare:1)UseopcodecachinglikeOPcachetoreduceexecutiontime,2)Optimizedatabaseinteractionswithpreparedstatementsandproperindexing,3)ConfigurewebserverslikeNginxwithPHP-FPMforbetterperformance,4)

APHPDependencyInjectionContainerisatoolthatmanagesclassdependencies,enhancingcodemodularity,testability,andmaintainability.Itactsasacentralhubforcreatingandinjectingdependencies,thusreducingtightcouplingandeasingunittesting.

Select DependencyInjection (DI) for large applications, ServiceLocator is suitable for small projects or prototypes. 1) DI improves the testability and modularity of the code through constructor injection. 2) ServiceLocator obtains services through center registration, which is convenient but may lead to an increase in code coupling.

PHPapplicationscanbeoptimizedforspeedandefficiencyby:1)enablingopcacheinphp.ini,2)usingpreparedstatementswithPDOfordatabasequeries,3)replacingloopswitharray_filterandarray_mapfordataprocessing,4)configuringNginxasareverseproxy,5)implementingcachingwi

PHPemailvalidationinvolvesthreesteps:1)Formatvalidationusingregularexpressionstochecktheemailformat;2)DNSvalidationtoensurethedomainhasavalidMXrecord;3)SMTPvalidation,themostthoroughmethod,whichchecksifthemailboxexistsbyconnectingtotheSMTPserver.Impl


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Zend Studio 13.0.1
Powerful PHP integrated development environment

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),
