rss· 投稿· 设为首页· 加入收藏· 繁體版
当前位置: 火魔网 » 程序开发 » PHP

PHP总结

<?php
其他 echo     " <script> window.location     =\ "http://www.csdn.net\ "; </script> "; round();对浮点数进行四舍五入
echo round(3.6, 0);      // 4
echo round(1.95583, 2);  // 1.96
echo round(1241757, -3); // 1242000
echo round(5.045, 2);    // 5.05
echo round(5.055, 2);    // 5.06 strtotime(string $time [, int $now ]) ― 将任何英文文本的日期时间描述解析为 Unix 时间戳 <meta   http-equiv= "refresh "   content= "3;URL=http://# "> mktime ― 取得一个日期的 Unix 时间戳 mysql_query("SET NAMES UTF8");
isset() 变量是否存在
boolean empty() 检查变量是否存在,并判断值是否为非空或非0
void unset() 销毁变量
header('Content-Type: text/html; charset=utf-8');
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
method_exists($obj, $method)    判断对象的方法是否可用
file_exists($file)    判断文件是否存在
class_exists($class_name);
date();--- d月份中第几天,有前导 0,w 星期中第几天,z 月份中第几天。W 年份中的第几周
m 月份,有前导 0 。n 月份,没前导 0。g (12小时制,无前导 0),G,h (12小时制,有前导 0),H 编码转换
string mb_convert_encoding ( string $str , string $to_encoding [, mixed $from_encoding ] ) 时间
mktime ― 取得一个日期的 Unix 时间戳
date_default_timezone_set("PRC");
date("Y-m-d H:i:s");
ini_set('date.timezone', 'PRC');
msec sec microtime() 以秒返回时间戳 explode(' ', microtime()) 魔术方法
__construct() 当实例化一个对象的时候,这个对象的这个方法首先被调用。
__destruct() 当删除一个对象或对象操作终止的时候,调用该方法。
__get() 当试图读取一个并不存在的属性的时候被调用。
__set() 当试图向一个并不存在的属性写入值的时候被调用。
__call() 当试图调用一个对象并不存在的方法时,调用该方法。
__toString() 当打印一个对象的时候被调用
__clone() 当对象被克隆时,被调用
__isset()
__unset()
__autoload($classname)
__sleep()
__wakeup() 系统常量
__FILE__ 当前文件名
__LINE__ 当前行数
__FUNCTION__ 当前函数名
__CLASS__ 当前类名
__METHOD__ 当前对象的方法名
PHP_OS 当前系统
PHP_VERSION php版本
DIRECTORY_SEPARATOR 根据系统决定目录的分隔符 /\
PATH_SEPARATOR 根据系统决定环境变量的目录列表分隔符 ; :
E_ERROR 1
E_WARNING 2
E_PARSE 4
E_NOTICE 8
M_PI    3.141592
$_SERVER
$_ENV 执行环境提交至脚本的变量
$_GET
$_POST
$_REQUEST
$_FILES
$_COOKIE
$_SESSION
$_GLOBALS 输出
echo
print
print_r()
var_dump()
var_export()
printf("%.1f",$num)
sprintf() 错误处理
顶一下
(0)
踩一下
(0)