<a id="chinese" <?php if(isset($_COOKIE['version']) && $_COOKIE['version'] == "cn"){ ?> class="active" <?php } ?> href="<?php echo __DOMAIN__;?>/index.php?c=index&a=index&version=cn">中文</a>
<a id="english" <?php if(isset($_COOKIE['version']) && $_COOKIE['version'] == "en"){ ?> class="active" <?php } ?> href="<?php echo __DOMAIN__;?>/index.php?c=index&a=index&version=en">English</a></div>
在控制器:
判断用户点击的是哪个语言
if(isset($_GET['version'])){
$version = $_GET['version'];
setcookie("version",$version,time()+(3600*24),"/");
}
。在前段判断cookie值即可:
<?php if(isset($_COOKIE['version']) && $_COOKIE['version'] == "cn"){ ?>
<div class="fl"><h3><?php echo $value['g_name'] ?></h3></div>
<span class="eng fl"> <?php echo $value['g_name_e'] ?></span>
<?php } else {?>
<div class="fl"><h3><?php echo $value['g_name_e'] ?></h3></div>
<?php }?>
