PHP 提供了一个极少使用的 similar_text 函数,但此函数非常有用,用于比较两个字符串并返回相似程度的百分比,以下是similar_text () 函数的使用方法: 复制代码 代码如下: similar_text($str...
复制代码 代码如下: /********************** *@file - path to zip file *@destination - destination directory for unzipped files */ function unzip_file($file, $destination){ // create object $zip = new ZipArchive() ; // open archive if...
复制代码 代码如下: /* creates a compressed zip file */ function create_zip($files = array(),$destination = '',$overwrite = false) { //if the zip file already exists and overwrite is false, return false if(file_exists($destination) !...
复制代码 代码如下: if (!preg_match("/^(http|ftp):/", $_POST['url'])) { $_POST['url'] = 'http://'.$_POST['url']; } 该代码先用正则表达式检查字符串中是否有"http”或"ftp"和冒号":",如果没有,在字符串前添...
复制代码 代码如下: function getCloud( $data = array(), $minFontSize = 12, $maxFontSize = 30 ) { $minimumCount = min( array_values( $data ) ); $maximumCount = max( array_values( $data ) ); $spread = $maximumCount - $minimumCount; $cl...
复制代码 代码如下: /******************** *@file - path to file */ function force_download($file) { if ((isset($file))(file_exists($file))) { header("Content-length: ".filesize($file)); header('Content-Type: application/octet-stream'...
复制代码 代码如下: /********************** *@filename - path to the image *@tmpname - temporary path to thumbnail *@xmax - max width *@ymax - max height */ function resize_image($filename, $tmpname, $xmax, $ymax) { $ext = explode("....
复制代码 代码如下: function makeClickableLinks($text) { $text = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_+.~#?lt;a href="\1"\1/a', $text); $text = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_+.~#?lt;a href="http://\2"...
1.不转意html entities 一个基本的常识:所有不可信任的输入(特别是用户从form中提交的数据) ,输出之前都要转意。 echo $_GET['usename'] ; 这个例子有可能输出: script/*更改admin密码的脚本...
操作系统:Windows 7 Ultimate WEB服务器:IIS 6.1(内部版本7600)。 数据库:MySql5.0.67 PHP版本:5.2.13 我还担心Win7下可能会不兼容,结果是一点问题都没有。 一、安装MySql数据库 MySql数据库在...