简单的计算php页面处理时间
<?php
function getmicrotime(){
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
//例子
//开始
$time_start = getmicrotime();
//这里放你的代码
//结束
$time_end = getmicrotime();
$time = $time_end - $time_start;
echo "Did nothing in $time seconds"; //输出运行总时间
?>
相关文档:
<?php
//--------------------
// 基本数据结构
//--------------------
//二分查找(数组里查找某个元素)
function bin_sch($arr, $low, $high, $k) {
if($low<=$high) {
$mid = intval(($low+$high)/2);
if($arr[$mid] == $k) {
return $mid;
} elseif($k<$ ......
<?php
function make_rand($length="32"){//验证码文字生成函数
$str="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
$result="";
for($i=0;$i<$length;$i++){
$num[$i]=rand(0,61);
$result.=$str[$num[$i]];
}
return $result;
} ......
1
<?
2
/*
*
3
* filename: ext_page.class.php
4
* @package:phpbean
5
* @author :feifengxlq<feifengxlq#gmail.com><[url=http://www.phpobject.net/]http://www.phpobject.net/[/url]>
& ......
一:结构和调用(实例化):
class className{} ,调用:$obj = new className();当类有构造函数时,还应传入参数。如$obj = new className($v,$v2...);
二:构造函数和析构函数:
1、构造函数用于初始化:使用__construct(),可带参数。
2、但析构函数不能带参数(用于在销去一个类之前执行一些操作或功能)。析构函数 ......
正好工作中配到此类问题,写出来和大家分享。很多网友提供了使用urlencode 和 urldecode的方式去编码和解码,说的不全面。有的时候也会碰到这样的问题。
1.首先要检查你apache和php的服务器默认语言。在window下,可以参考apache的配置文件httpd.conf。 在AddCharset附近在加上下面的命令行:
AddDefaultCharset UTF-8
......