我想把网站实现国际化,就是有英文和中文的两种语言,怎么做呢,

解决方案 »

  1.   

    不知道你是不是想要php-gettexthttp://php.net/manual/en/function.gettext.php<?php
    // Set language to German
    putenv('LC_ALL=de_DE');
    setlocale(LC_ALL, 'de_DE');// Specify location of translation tables
    bindtextdomain("myPHPApp", "./locale");// Choose domain
    textdomain("myPHPApp");// Translation is looking for in ./locale/de_DE/LC_MESSAGES/myPHPApp.mo now// Print a test message
    echo gettext("Welcome to My PHP Application");// Or use the alias _() for gettext()
    echo _("Have a nice day");
    ?>
      

  2.   

    看看phpcms的源码,基本上就是通过数组来完成的
      

  3.   

    原理1#已经说了看看discuz phpwind dedecms 你就明白了
      

  4.   

    chn.php
    /***********/
    $title = "标题";
    /***********/
    eng.php
    /***********/
    $title = "Title";
    /***********/页面中写$title,切换语言就是切换chn.php和eng.php的区别
      

  5.   

    把你想要的语言写成文件ch.php、en.php   定义关键词变量 在程序前包含 模板中关键词写成变量形式就好 比如:连接 ch 就调用 ch.php; en 就调用en.php