易截截图软件、单文件、免安装、纯绿色、仅160KB

php常用技巧

如何判断ip地址合法性
if(!strcmp(long2ip(sprintf("%u",ip2long($ip))),$ip)) echo "is ipn";
 email的正则判断
eregi("^[_.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z_-]+.)+[a-zA-Z]$", $email);
检测ip地址和mask是否合法的例子
$ip = '192.168.0.84';
$mask = '255.255.255.0';
$network = '192.168.0';
$ip = ip2long($ip);
$mask = ip2long($mask);
$network = ip2long($network);
if( ($ip & $mask) == $network) echo "valid ip and maskn";
?>
文件下载头部输出如何设定
header("Content-type: application/x-download");
header("Content-Disposition: attachment; filename=$file_download_name;");
header("Accept-Ranges: bytes");
header("Content-Length: $download_size");
echo 'xxx'
用header输出ftp下载方式,并且支持断点续传
一个例子:
header('Pragma: public');
header('Cache-Control: private');
header('Cache-Control: no-cache, must-revalidate');
header('Accept-Ranges: bytes');
header('Connection: close');
header("Content-Type: audio/mpeg");
header("Location:ftp://download:1bk3l4s3k9s2@232.2.22.22/2222/web技术开发知识库/cn_web.rmvb");
正则匹配中文
ereg("^[".chr(0xa1)."-".chr(0xff)."]+$", $str);
批量替换文本里面的超级链接
<?php
function urlParse($str = ''){
    if ('' == $str) return $str;
$types = array("http", "ftp", "https");
$replace = <<<EOPHP
  '<a href="'.htmlentities('\1').htmlentities('\2').'">'.htmlentities('\1').htmlentities('\2').'</a>'
EOPHP;
$ret = $str;
while(list(,$type) = each($types)){
  $ret = preg_replace("|($type://)([^\s]*)|ie ", $replace, $ret);
}
return $ret;
}
?>


相关文档:

Guoqzhang_PHP 简易php framework

Guoqzhang_PHP 简易php framework    请多指点。
Guoqzhang_PHP V 1.0 的PHP开发框架,采用MVC设计模式,运用Smarty模板引擎术和MySQL数据库技术开发而成。
 设计到开发完成耗时20个工作日左右,时间短,可能存在一些bug,请大家指正.作者mail:guoqzhang@gmail.com
url:http://download.csdn ......

PHP UUID的生成源码

现在好多地方都用UUID,比如数据库的个自动的UUID
UUID结构如下(都为十六进制字符)
XXXXX
XXX-XXXX-XXXX-XXXX-XXXXXXXXXXX
研究其生成实现过程才发现,原来是这样的
1、提取当前时候值和时间戳
2、把这两个值转换成十六进制
3、取时间值和时间戳的前5和时间值的前六位
4、生成一个三位的十六进制,三个四位的 ......

php实现一个日历类

<?php
 date_default_timezone_set("Etc/GMT-8");
 header("content-type:text/html; charset=utf-8");
 /**
  * 自己定义的一个生成日历的类
  * @author 张伟灿<yuanfen860913@163.com>
  * @version 1.0.0
  *
  */
 class myCalendar
 {
  ......

php中substr的用法详解

php中substr的用法详解
php.net中关于substr的说明很简单:
start
If start is non-negative, the returned string will start at the start 'th position in string , counting from zero. For instance, in the string 'abcdef', the character at position 0 is 'a', the character at position 2 is 'c', and so for ......

php常用函数2

文件读取函式
   //文件读取函式
   function PHP_Read($file_name) {
   $fd=fopen($file_name,r);
   while($bufline=fgets($fd, 4096)){
   $buf.=$bufline;
    }
   fclose($fd);
   return $buf;
    }
& ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号