php简单国际化
来源:互联网 发布:ubuntu 挂载不了硬盘 编辑:程序博客网 时间:2024/05/22 12:21
index.html 显示页面
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"><title>Document</title><script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script><script>$(function() {$('#ch').click(function(){$.ajax({url: 'index.php',type: 'post',datatype: 'json',data: 'lang=ch',success:function(msg) {$('p').text(msg);}})})$('#us').click(function(){$.ajax({url: 'index.php',type: 'post',datatype: 'json',data: 'lang=us',success:function(msg) {$('p').text(msg);}})})})</script></head><body><p>小明</p><input type="button" value="中文" id="ch"/><input type="button" value="English" id="us"/></body></html>
index.php 处理页面
<?php!isset($_POST['lang']) ? $rs = null : $rs = htmlspecialchars($_POST['lang']);switch ($rs) {case 'ch':$a = 'ch';break;default:$a = 'en';break;}require "lang-{$a}.php";echo $name;
语言包
英文lang-us.php
<?php/* * @Author: xinghuang@hengtiansoft.com* @Date: 2014-05-23 11:13:22* @Last Modified by: xinghuang@hengtiansoft.com* @Last Modified time: 2014-05-23 11:32:33*/$name='xiaoming';中文lang-ch.php
<?php/* * @Author: xinghuang@hengtiansoft.com* @Date: 2014-05-23 11:14:16* @Last Modified by: xinghuang@hengtiansoft.com* @Last Modified time: 2014-05-23 11:32:29*/$name='小明';
0 0
- php简单国际化
- php gettext国际化
- php程序的国际化
- php gettext国际化
- php gettext国际化
- php----网站国际化思考
- 国际化(简单例子)
- struts2国际化简单案例
- 国际化的简单示例
- iOS 国际化简单记录
- js简单实现国际化
- springmvc 简单国际化
- 如何将 PHP 应用程序国际化
- 如何将 PHP 应用程序国际化
- php 程序的国际化gettext
- struts 国际化简单小经验
- winForm 国际化的简单实现
- winForm 国际化的简单实现
- UITableVeiw空白的Cell设置空
- org.hibernate.hql.antlr.HqlBaseParser.recover(Lantlr/RecognitionException;Lantlr/collections/impl..
- 嵌入式工程师面试题目
- 翻译(handleAndroid Async http)
- servlet/filter/listener/interceptor区别与联系
- php简单国际化
- 程序员,10年后你在干什么?
- 字符串压缩程序
- 一段精妙的参数检查代码
- 八.使用OpenCv对图像进行平滑操作
- eclipse 强行关闭后一直闪退
- tup
- oracle 11g速度慢、plsql登录查询慢、服务器本地sqlplus正常
- ERROR The requested URL could not be retrieved The following error was encountered