【PHP 加密/解密函数 dencrypt(动态密文,带压缩功能,支持中文)】教程文章相关的互联网学习教程文章

使用PHP的tidy_clean_repair()对HTML进行压缩

$options = array("clean" => true, "drop-proprietary-attributes" => true, "drop-font-tags" => true, "drop-empty-paras" => true, "hide-comments" => true, "join-classes" => true, "join-styles" => true); $tidy = tidy_parse_file("http://www.php.com/", $options); tidy_clean_repair($tidy); echo $tidy;?>

php压缩与解压缩类PclZip的例子

require_once('pclzip.lib.php');$zip = new PclZip("archive.zip");$v_list = $zip->create($_SERVER['DOCUMENT_ROOT'] ,PCLZIP_OPT_REMOVE_PATH,$_SERVER['DOCUMENT_ROOT']);if($v_list == 0){ echo '异常:'.$z->errorInfo(true); }else { echo '备份成功'; }?>其它用法举例://解压缩到extract/folder/这个目录中$list = $archive->extract(PCLZIP_OPT_PATH, "extract/folder/");//增加这个目录在压缩档中,完成以后压缩档里面...

php实现在线解压zip压缩文件

本文实例讲述了php在线解压ZIP文件的方法。分享给大家供大家参考。具体分析如下:在PHP的函数库中只找到了个ZLIB的函数还跟压缩有点关系,但是使我失望的是他没能解ZIP的文件,但最后还是让我找到了解决的方法,就是通过PHP的程序执行函数来实现这个功能,因为现在能解ZIP文件的东西实在是太多啦,你要是不信,可以到有下载软件的地方找找看,保准你不会失望的,我的话不会错的.下面就是该程序的原文件,upload.php代码如下:<table border="...

LZW压缩算法

PHP实现的LZW压缩算法 /** * @link http://code.google.com/p/php-lzw/* @author Jakub Vrana, http://php.vrana.cz/* @copyright 2009 Jakub Vrana* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0*//** LZW compression* @param string data to compress* @return string binary data*/function lzw_compress($string) { // compression $dictionary = array_flip(range("\0", "\xFF")); ...

短网址api,网址压缩,网址缩短

http://qita.in/api.html $urls="http://qita.in/api.php?url=".$_POST['url'];$shorturls = file_get_contents($urls);$shorturls=trim($shorturls);$shorturls=iconv("UTF-8", "GB2312//IGNORE", $shorturls);echo $shorturls;?>

php压缩html网页代码(清除空格、换行符、制表符、注释标记等)的方法

/*** 压缩html : 清除换行符,清除制表符,去掉注释标记* @param $string* @return 压缩后的$string* from: bbs.it-home.org* */function compress_html($string) {$string = str_replace("\r\n", '', $string); //清除换行符$string = str_replace("\n", '', $string); //清除换行符$string = str_replace("\t", '', $string); //清除制表符$pattern = array ("/> *([^ ]*) *"/[\s]+/","//","/\" /","/ \"/","'/\*[^*]*\*/'");$repl...

压缩多个CSS与JS文件的php代码

header('Content-type: text/css'); ob_start("compress"); function compress($buffer) { /* remove comments */ $buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer); /* remove tabs, spaces, newlines, etc. */ $buffer = str_replace(array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), '', $buffer); return $buffer; } ...

php进行文件Zip压缩的代码

/* creates a compressed zip file */function create_zip($files = array(),$destination = '',$overwrite = false) {//if the zip file already exists and overwrite is false, return falseif(file_exists($destination) && !$overwrite) { return false; }//vars$valid_files = array();//if files were passed in...if(is_array($files)) {//cycle through each fileforeach($files as $file) {//make sure the file existsi...

php解压缩Zip文件的代码

/***********************@file - path to zip file*@destination - destination directory for unzipped files*/function unzip_file($file, $destination){// create object$zip = new ZipArchive() ;// open archiveif ($zip->open($file) !== TRUE) {die ('Could not open archive');}// extract contents to destination directory$zip->extractTo($destination);// close archive$zip->close();echo 'Archive extracted to d...

用来自动压缩js文件的php代码

/* 9 April 2008. version 1.1 * * This is the php version of the Dean Edwards JavaScript's Packer, * Based on : * * ParseMaster, version 1.0.2 (2005-08-19) Copyright 2005, Dean Edwards * a multi-pattern parser. * KNOWN BUG: erroneous behavior when using escapeChar with a replacement * value that is a function * * packer, version 2.0.2 (2005-08-19...

ComboScript自动合并/压缩脚本仿淘宝

Combo Script自动合并/压缩脚本 完整代码下载: http://www.ctdisk.com/file/9402163 脚本使用: - 要求php5及以上版本 - 程序在找不到本地文件的情况下,会去指定的cdn上找同名文件 - 程序会自动转义-min文件为源文件,因此要约定-min文件和原文件要成对出现 - 需要定义combo.php和minify.php中的$YOUR_CDN变量 - 如果只是合并压缩local文件,则不必重置$YOUR_CDN变量 - 这里提供cb.php,用来实现tbcdn的开发环境的模拟,apache的配...

php图片压缩的实现代码【图】

/*函数:调整图片尺寸或生成缩略图返回:True/False参数: $Image 需要调整的图片(含路径) $Dw=450 调整时最大宽度;缩略图时的绝对宽度 $Dh=450 调整时最大高度;缩略图时的绝对高度 $Type=1 1,调整尺寸; 2,生成缩略图 site http://bbs.it-home.org*/$path='img/';//路径$phtypes=array( 'img/gif', 'img/jpg', 'img/jpeg', 'img/bmp', 'img/pjpeg', 'img/x-png');FunctionImg($Image,$Dw=450,$Dh=450,$...

phpgzip压缩js与css代码的例子

为节省带宽,我们经常需要对文件进行压缩后传输,在php编程中,最常见的就是使用gzip模块对css与js文件进行压缩,本文为大家举一个这方面的例子,供大家参考。首先,来了解下压缩的优势: 1)、将多个CSS/JS文档合并成一个文件,以减少HTTP请求。 2)、对合并后的文件进行文档压缩,比如分别使用js compressor和CSS compress。 3)、如果使用到一些主流的JavaScript框架,比如JQuery, Mootools或者YUI,强烈推荐直接使用Google AJ...

phpgzip页面压缩的两个例子

为大家举二个php使用gzip进行页面压缩的例子,gzip可以压缩js、css、图片文件等,本文介绍的二个简单例子,特别适合初学的朋友参考,快来看看吧。例1,php 内置压缩函数的例子php程序员的笔记 例2,自写函数实现压缩自写函数压缩_bbs.it-home.org

php压缩文件为zip格式的函数代码

/* @creates a compressed zip file 将多个文件压缩成一个zip文件的函数 * @$files 数组类型 实例array("1.jpg","2.jpg"); * @destination 目标文件的路径 如"c:/androidyue.zip" * @$overwrite 是否为覆盖与目标文件相同的文件 * @site http://bbs.it-home.org */ function create_zip($files = array(),$destination = '',$overwrite = false) { //if the zip file already ex...

功能 - 相关标签