久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    <bdo id='YgQXm'></bdo><ul id='YgQXm'></ul>
<tfoot id='YgQXm'></tfoot>
<legend id='YgQXm'><style id='YgQXm'><dir id='YgQXm'><q id='YgQXm'></q></dir></style></legend>
    <i id='YgQXm'><tr id='YgQXm'><dt id='YgQXm'><q id='YgQXm'><span id='YgQXm'><b id='YgQXm'><form id='YgQXm'><ins id='YgQXm'></ins><ul id='YgQXm'></ul><sub id='YgQXm'></sub></form><legend id='YgQXm'></legend><bdo id='YgQXm'><pre id='YgQXm'><center id='YgQXm'></center></pre></bdo></b><th id='YgQXm'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='YgQXm'><tfoot id='YgQXm'></tfoot><dl id='YgQXm'><fieldset id='YgQXm'></fieldset></dl></div>

    <small id='YgQXm'></small><noframes id='YgQXm'>

        編程多語言 PHP 應(yīng)用程序

        Programming Multi-Language PHP applications(編程多語言 PHP 應(yīng)用程序)
        <legend id='sh1VM'><style id='sh1VM'><dir id='sh1VM'><q id='sh1VM'></q></dir></style></legend>

            <small id='sh1VM'></small><noframes id='sh1VM'>

              • <bdo id='sh1VM'></bdo><ul id='sh1VM'></ul>

                  <tfoot id='sh1VM'></tfoot>
                • <i id='sh1VM'><tr id='sh1VM'><dt id='sh1VM'><q id='sh1VM'><span id='sh1VM'><b id='sh1VM'><form id='sh1VM'><ins id='sh1VM'></ins><ul id='sh1VM'></ul><sub id='sh1VM'></sub></form><legend id='sh1VM'></legend><bdo id='sh1VM'><pre id='sh1VM'><center id='sh1VM'></center></pre></bdo></b><th id='sh1VM'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='sh1VM'><tfoot id='sh1VM'></tfoot><dl id='sh1VM'><fieldset id='sh1VM'></fieldset></dl></div>
                    <tbody id='sh1VM'></tbody>
                  本文介紹了編程多語言 PHP 應(yīng)用程序的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在開發(fā)一個 PHP 應(yīng)用程序,我想知道為其他國家/地區(qū)的用戶提供多語言支持的最佳方式.

                  I'm developing a PHP application and I'm wondering about the best way to include multi-language support for users in other countries.

                  我精通 PHP,但從未開發(fā)過支持其他語言的任何東西.

                  I'm proficient with PHP but have never developed anything with support for other languages.

                  我正在考慮將語言放入帶有常量的 PHP 文件中,例如:

                  I was thinking of putting the language into a PHP file with constants, example:

                  en.php 可以包含:

                  en.php could contain:

                  define('HZ_DB_CONN_ERR', 'There was an error connecting to the database.');
                  

                  和 fr.php 可以包含:

                  and fr.php could contain:

                  define('HZ_DB_CONN_ERR', 'whatever the french is for the above...');
                  

                  然后我可以調(diào)用一個函數(shù)并自動傳入正確的語言.

                  I could then call a function and automatically have the correct language passed in.

                  hz_die('HZ_DB_CONN_ERR', $this);
                  

                  這是解決問題的好方法嗎?

                  Is this a good way of going about it?

                  -- morristhebear.

                  -- morristhebear.

                  推薦答案

                  奇怪.人們似乎忽略了顯而易見的解決方案.您對特定于語言環(huán)境的文件的想法很好.有en.php:

                  Weird. People seem to be ignoring the obvious solution. Your idea of locale-specific files is fine. Have en.php:

                  define('LOGIN_INCORRECT','Your login details are incorrect.');
                  ...
                  

                  然后,假設(shè)您有一個全局配置/常量文件(出于多種原因,我建議這樣做),請使用如下代碼:

                  Then, assuming you have a global config/constants file (which I'd suggest for many reasons), have code like this:

                  if ($language == 'en') {
                    reqire_once 'en.php';
                  } else if ($language == 'de') {
                    require_once 'de.php';
                  }
                  

                  您可以定義數(shù)字和貨幣顯示、比較/排序(即德語、法語和英語都有不同的整理方法)等功能.

                  You can define functions for number and currency display, comparison/sorting (ie German, French and English all have different collation methods), etc.

                  人們常常忘記 P??HP 是一種動態(tài)語言,所以像這樣:

                  People often forget PHP is a dynamic language so things like this:

                  if ($language == 'en') {
                    function cmp($a, $b) { ... }
                  } else if ($language == 'de') {
                    function cmp($a, $b) { ... }
                  }
                  

                  實際上是完全合法的.使用它們.

                  are in fact perfectly legal. Use them.

                  這篇關(guān)于編程多語言 PHP 應(yīng)用程序的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                  PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動游標不起作用)
                  PHP PDO ODBC connection(PHP PDO ODBC 連接)
                  Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術(shù)方法)
                  php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                  MSSQL PDO could not find driver(MSSQL PDO 找不到驅(qū)動程序)

                    <tbody id='jI5Nu'></tbody>
                          <bdo id='jI5Nu'></bdo><ul id='jI5Nu'></ul>
                        • <legend id='jI5Nu'><style id='jI5Nu'><dir id='jI5Nu'><q id='jI5Nu'></q></dir></style></legend>

                        • <small id='jI5Nu'></small><noframes id='jI5Nu'>

                          <i id='jI5Nu'><tr id='jI5Nu'><dt id='jI5Nu'><q id='jI5Nu'><span id='jI5Nu'><b id='jI5Nu'><form id='jI5Nu'><ins id='jI5Nu'></ins><ul id='jI5Nu'></ul><sub id='jI5Nu'></sub></form><legend id='jI5Nu'></legend><bdo id='jI5Nu'><pre id='jI5Nu'><center id='jI5Nu'></center></pre></bdo></b><th id='jI5Nu'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='jI5Nu'><tfoot id='jI5Nu'></tfoot><dl id='jI5Nu'><fieldset id='jI5Nu'></fieldset></dl></div>
                            <tfoot id='jI5Nu'></tfoot>
                            主站蜘蛛池模板: 中文字幕一区二区三区在线观看 | 一区二区三区av夏目彩春 | 在线看一区二区 | 紧缚调教一区二区三区视频 | 欧美二区在线 | 精品日韩一区二区三区av动图 | 91精品一区 | 国产亚洲一区二区精品 | 欧美一级片 | 国产精品我不卡 | 日韩在线看片 | 亚洲乱码一区二区三区在线观看 | 久久人操 | 丁香六月激情 | 午夜视频免费在线 | 九九热在线观看视频 | 黄色日本片| 国产精品久久久久久久久久 | 一区二区三区免费 | 国产97在线 | 日韩 | 国产亚洲久| 久久机热| 亚洲福利精品 | 国产精品久久av | 国产免费让你躁在线视频 | 久久高清精品 | 欧美一级二级三级视频 | cao在线 | 国产一区二区精品在线观看 | 一区在线播放 | 亚洲iv一区二区三区 | 日韩一区二区在线看 | 在线观看www视频 | 国产一区二区在线免费观看 | 91久久国产综合久久 | 国产原创视频 | 国产欧美一区二区三区在线播放 | 中文字幕 国产 | 久久九九色 | 欧美日韩国产一区 | 日韩一区二区在线视频 |