1、检查文件头是否是utf-8:
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
2、如果是纯PHP这加上:
header(“content-type:text/html; charset=utf-8″);
3、查看文件编码是否是utf-8:
用记事本打开文件,点击另存为,将编码改成UTF-8
4、查询数据库之前加上:
mysql_query(“SET NAMES ‘utf8′”);
修改php.ini:
max_execution_time = 30 时间,然后重起apache
或者在程序写
set_time_limit(时间); //0为无限制.
date_default_timezone_set(‘PRC’);
大陆内地可用的值是:Asia/Chongqing ,Asia/Shanghai ,Asia/Urumqi (依次为重庆,上海,乌鲁木齐)
switch($sigle["CarryType"]){
case “can”:
$carrytype = “Cancarry”;
break;
case “seek”:
$carrytype = “Seekcarry”;
break;
case “together”:
$carrytype = “Together”;
break;
default:
$carrytype = “”;
}
echo time();//当前时间戳
echo date(‘Y-m-d H:i:s’,”1263787258″);//将时间戳转换成时间格式
echo strtotime(“2010-01-21 15:37:00″);//将时间格式转换成时间戳
str_replace() 函数使用一个字符串替换字符串中的另一些字符。
语法
str_replace(find,replace,string,count)
| 参数 |
描述 |
| find |
必需。规定要查找的值。 |
| replace |
必需。规定替换 find 中的值的值。 |
| string |
必需。规定被搜索的字符串。 |
| count |
可选。一个变量,对替换数进行计数。 |
例子 1
<?php
echo str_replace("world","John","Hello world!");
?>
输出:
Hello John!
echo $_SERVER ['HTTP_HOST'].$_SERVER['REQUEST_URI'];