PHP to do the project in English and Chinese switch, how to quickly achieve

Source: Internet
Author: User
This is the method that I summarize when I am doing the project, of course, if you have a better way, you can share it with me.

Generally I would suggest to build 2 documents, a Chinese one in English

On the View page:

              ' CN '));?> "> Chinese" en ")        ?>" >english      

On the Controller page:

$page = ' newexhibitors ', if (isset ($_get[' language ')) {   if ($_get[' language ']== ' cn ') {       $_session[' lan '] = ' cn ' ;       $title = ' test ';       Require APP::TPL (' newexhibitors ');   } else if ($_get[' language ']== ' en ') {       $_session[' lan '] = ' en ';       $title = ' Test ';       Require APP::TPL (' en_newexhibitors ');}   } else{    if ($_session[' LAN ')} {       if ($_session[' LAN ']== ' CN ') {            $title = ' Test ';            Require APP::TPL (' newexhibitors ');       } else{            $title = ' Test ';            Require APP::TPL (' en_newexhibitors ');       }    } else{       $_session[' LAN ']= ' CN ';       $title = ' test ';       Require APP::TPL (' newexhibitors ');}    }

This code implementation of the effect, click on the "Chinese/English" text switch, automatically on the current page to switch

  • 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.