PHP教程 - 爱资料
分类:
PHP similar

PHP similar

栏目分类:PHP 浏览次数:197 发布时间:2015-12-29

PHP 提供了一个极少使用的 similar_text 函数,但此函数非常有用,用于比较两个字符串并返回相似程度的百分比,以下是similar_text () 函数的使用方法: 复制代码 代码如下: similar_text($str...

TAG:
PHP Zip解压 文件在线解压缩的函数代码

PHP Zip解压 文件在线解压缩的函数代码

栏目分类:PHP 浏览次数:245 发布时间:2015-12-29

复制代码 代码如下: /********************** *@file - path to zip file *@destination - destination directory for unzipped files */ function unzip_file($file, $destination){ // create object $zip = new ZipArchive() ; // open archive if...

TAG:
PHP Zip压缩 在线对文件进行压缩的函数

PHP Zip压缩 在线对文件进行压缩的函数

栏目分类:PHP 浏览次数:273 发布时间:2015-12-29

复制代码 代码如下: /* 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) !...

TAG:
PHP为表单获取的URL 地址预设 http 字符串函数代码

PHP为表单获取的URL 地址预设 http 字符串函数代码

栏目分类:PHP 浏览次数:198 发布时间:2015-12-29

复制代码 代码如下: if (!preg_match("/^(http|ftp):/", $_POST['url'])) { $_POST['url'] = 'http://'.$_POST['url']; } 该代码先用正则表达式检查字符串中是否有"http”或"ftp"和冒号":",如果没有,在字符串前添...

TAG:
PHP 创建标签云函数代码

PHP 创建标签云函数代码

栏目分类:PHP 浏览次数:176 发布时间:2015-12-29

复制代码 代码如下: function getCloud( $data = array(), $minFontSize = 12, $maxFontSize = 30 ) { $minimumCount = min( array_values( $data ) ); $maximumCount = max( array_values( $data ) ); $spread = $maximumCount - $minimumCount; $cl...

TAG:
PHP 强制性文件下载功能的函数代码(任意文件格式)

PHP 强制性文件下载功能的函数代码(任意文件格式)

栏目分类:PHP 浏览次数:190 发布时间:2015-12-29

复制代码 代码如下: /******************** *@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'...

TAG:
PHP 图像尺寸调整代码

PHP 图像尺寸调整代码

栏目分类:PHP 浏览次数:194 发布时间:2015-12-29

复制代码 代码如下: /********************** *@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("....

TAG:
用PHP将网址字符串转换成超链接(网址或email)

用PHP将网址字符串转换成超链接(网址或email)

栏目分类:PHP 浏览次数:241 发布时间:2015-12-29

复制代码 代码如下: 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"...

TAG:
php 编写安全的代码时容易犯的错误小结

php 编写安全的代码时容易犯的错误小结

栏目分类:PHP 浏览次数:191 发布时间:2015-12-29

1.不转意html entities 一个基本的常识:所有不可信任的输入(特别是用户从form中提交的数据) ,输出之前都要转意。 echo $_GET['usename'] ; 这个例子有可能输出: script/*更改admin密码的脚本...

TAG:
Windows7下PHP开发环境安装配置图文方法

Windows7下PHP开发环境安装配置图文方法

栏目分类:PHP 浏览次数:199 发布时间:2015-12-29

操作系统:Windows 7 Ultimate WEB服务器:IIS 6.1(内部版本7600)。 数据库:MySql5.0.67 PHP版本:5.2.13 我还担心Win7下可能会不兼容,结果是一点问题都没有。 一、安装MySql数据库 MySql数据库在...

TAG: