好得很程序员自学网
  • 首页
  • 后端语言
    • C#
    • PHP
    • Python
    • java
    • Golang
    • ASP.NET
  • 前端开发
    • Angular
    • react框架
    • LayUi开发
    • javascript
    • HTML与HTML5
    • CSS与CSS3
    • jQuery
    • Bootstrap
    • NodeJS
    • Vue与小程序技术
    • Photoshop
  • 数据库技术
    • MSSQL
    • MYSQL
    • Redis
    • MongoDB
    • Oracle
    • PostgreSQL
    • Sqlite
    • 数据库基础
    • 数据库排错
  • CMS系统
    • HDHCMS
    • WordPress
    • Dedecms
    • PhpCms
    • 帝国CMS
    • ThinkPHP
    • Discuz
    • ZBlog
    • ECSHOP
  • 高手进阶
    • Android技术
    • 正则表达式
    • 数据结构与算法
  • 系统运维
    • Windows
    • apache
    • 服务器排错
    • 网站安全
    • nginx
    • linux系统
    • MacOS
  • 学习教程
    • 前端脚本教程
    • HTML与CSS 教程
    • 脚本语言教程
    • 数据库教程
    • 应用系统教程
  • 新技术
  • 编程导航
    • 区块链
    • IT资讯
    • 设计灵感
    • 建站资源
    • 开发团队
    • 程序社区
    • 图标图库
    • 图形动效
    • IDE环境
    • 在线工具
    • 调试测试
    • Node开发
    • 游戏框架
    • CSS库
    • Jquery插件
    • Js插件
    • Web框架
    • 移动端框架
    • 模块管理
    • 开发社区
    • 在线课堂
    • 框架类库
    • 项目托管
    • 云服务

当前位置:首页>后端语言>PHP
<tfoot draggable='sEl'></tfoot>

php文件crc PHP文件管理系统

很多站长朋友们都不太清楚php文件crc,今天小编就来给大家整理php文件crc,希望对各位有所帮助,具体内容如下:

本文目录一览: 1、 PHP后缀名的文件是什么文件怎么打开? 2、 php是什么格式的文件,怎么播放(打开)? 3、 php怎样实现对zip文件的加密和解密 4、 关于php实现crc冗余算法的验证和补全问题 PHP后缀名的文件是什么文件怎么打开?

PHP是一个网页脚本,但不同于html xml 标签语言,直接可以通过浏览器打开,需要有PHP的运行环境才可以访问和打开文件,如果只是编辑PHP打开文件,只需要用

记事本;

Dreamweaver;

EclipsePHP;

editplus .

使用记事本打开php文件的方法是将鼠标放在php文件上:

鼠标右键——选择打开方式——选择记事本打开即可:

php是什么格式的文件,怎么播放(打开)?

PHP是超级文本预处理语言的缩写,是一种HTML内嵌式的语言。

打开PHP文件的方法和操作步骤如下:

1、第一步,找到桌面的php文件,见下图,然后进入下一步。

2、其次,完成上述步骤后,右键单击php文件,然后从弹出的列表中选择“打开方式”选项,见下图,然后进入下一步。

3、接着,完成上述步骤后,从打开的选项中选择“记事本”选项,见下图,然后进入下一步。

4、然后,完成上述步骤后,可以在记事本中看到PHP代码,见下图,然后进入下一步。

5、随后,完成上述步骤后,鼠标右击php文件,在出现的列表中选择“Edit with Notepad++”选项,见下图,然后进入下一步。

6、最后,完成上述步骤后,可以看到在Notepad

 ++中打开的php代码。 可以看到php代码此时显示不同的颜色,这是Notepad ++的亮点,如下图所示。这样,问题就解决了。

php怎样实现对zip文件的加密和解密

使用PHPZip类就可以解决的。以下是网上找到的例子。

        $zipfiles =array("/root/pooy/test1.txt","/root/pooy/test2.txt");

        $z = new PHPZip();

        //$randomstr = random(8);

        $zipfile = TEMP."/photocome_".$groupid.".zip";

        $z->Zip($zipfiles, $zipfile);

<?php

# 

# PHPZip v1.2 by Sext (sext@neud.net) 2002-11-18

#     (Changed: 2003-03-01)

# 

# Makes zip archive

#

# Based on "Zip file creation class", uses zLib

#

#

class PHPZip

{

    function Zip($dir, $zipfilename)

    {

        if (@function_exists('gzcompress'))

        {    

            $curdir = getcwd();

            if (is_array($dir)) 

            {

                    $filelist = $dir;

            }

            else 

            {

                $filelist = $this -> GetFileList($dir);

            }

            if ((!empty($dir))(!is_array($dir))(file_exists($dir))) chdir($dir);

            else chdir($curdir);

            if (count($filelist)>0)

            {

                foreach($filelist as $filename)

                {

                    if (is_file($filename))

                    {

                        $fd = fopen ($filename, "r");

                        $content = fread ($fd, filesize ($filename));

                        fclose ($fd);

                        if (is_array($dir)) $filename = basename($filename);

                        $this -> addFile($content, $filename);

                    }

                }

                $out = $this -> file();

                chdir($curdir);

                $fp = fopen($zipfilename, "w");

                fwrite($fp, $out, strlen($out));

                fclose($fp);

            }

            return 1;

        } 

        else return 0;

    }

    function GetFileList($dir)

    {

        if (file_exists($dir))

        {

            $args = func_get_args();

            $pref = $args[1];

            $dh = opendir($dir);

            while($files = readdir($dh))

            {

                if (($files!=".")($files!="..")) 

                {

                    if (is_dir($dir.$files)) 

                    {

                        $curdir = getcwd();

                        chdir($dir.$files);

                        $file = array_merge($file, $this -> GetFileList("", "$pref$files/"));

                        chdir($curdir);

                    }

                    else $file[]=$pref.$files;

                }

            }

            closedir($dh);

        }

        return $file;

    }

    var $datasec      = array();

    var $ctrl_dir     = array();

    var $eof_ctrl_dir = "x50x4bx05x06x00x00x00x00";

    var $old_offset   = 0;

    /**

     * Converts an Unix timestamp to a four byte DOS date and time format (date

     * in high two bytes, time in low two bytes allowing magnitude comparison).

     *

     * @param  integer  the current Unix timestamp

     *

     * @return integer  the current date in a four byte DOS format

     *

     * @access private

     */

    function unix2DosTime($unixtime = 0) {

        $timearray = ($unixtime == 0) ? getdate() : getdate($unixtime);

        if ($timearray['year'] < 1980) {

            $timearray['year']    = 1980;

            $timearray['mon']     = 1;

            $timearray['mday']    = 1;

            $timearray['hours']   = 0;

            $timearray['minutes'] = 0;

            $timearray['seconds'] = 0;

        } // end if

        return (($timearray['year'] - 1980) << 25) | ($timearray['mon'] << 21) | ($timearray['mday'] << 16) |

                ($timearray['hours'] << 11) | ($timearray['minutes'] << 5) | ($timearray['seconds'] >> 1);

    } // end of the 'unix2DosTime()' method

    /**

     * Adds "file" to archive

     *

     * @param  string   file contents

     * @param  string   name of the file in the archive (may contains the path)

     * @param  integer  the current timestamp

     *

     * @access public

     */

    function addFile($data, $name, $time = 0)

    {

        $name     = str_replace('', '/', $name);

        $dtime    = dechex($this->unix2DosTime($time));

        $hexdtime = 'x' . $dtime[6] . $dtime[7]

                  . 'x' . $dtime[4] . $dtime[5]

                  . 'x' . $dtime[2] . $dtime[3]

                  . 'x' . $dtime[0] . $dtime[1];

        eval('$hexdtime = "' . $hexdtime . '";');

        $fr   = "x50x4bx03x04";

        $fr   .= "x14x00";            // ver needed to extract

        $fr   .= "x00x00";            // gen purpose bit flag

        $fr   .= "x08x00";            // compression method

        $fr   .= $hexdtime;             // last mod time and date

        // "local file header" segment

        $unc_len = strlen($data);

        $crc     = crc32($data);

        $zdata   = gzcompress($data);

        $c_len   = strlen($zdata);

        $zdata   = substr(substr($zdata, 0, strlen($zdata) - 4), 2); // fix crc bug

        $fr      .= pack('V', $crc);             // crc32

        $fr      .= pack('V', $c_len);           // compressed filesize

        $fr      .= pack('V', $unc_len);         // uncompressed filesize

        $fr      .= pack('v', strlen($name));    // length of filename

        $fr      .= pack('v', 0);                // extra field length

        $fr      .= $name;

        // "file data" segment

        $fr .= $zdata;

        // "data descriptor" segment (optional but necessary if archive is not

        // served as file)

        $fr .= pack('V', $crc);                 // crc32

        $fr .= pack('V', $c_len);               // compressed filesize

        $fr .= pack('V', $unc_len);             // uncompressed filesize

        // add this entry to array

        $this -> datasec[] = $fr;

        $new_offset        = strlen(implode('', $this->datasec));

        // now add to central directory record

        $cdrec = "x50x4bx01x02";

        $cdrec .= "x00x00";                // version made by

        $cdrec .= "x14x00";                // version needed to extract

        $cdrec .= "x00x00";                // gen purpose bit flag

        $cdrec .= "x08x00";                // compression method

        $cdrec .= $hexdtime;                 // last mod time  date

        $cdrec .= pack('V', $crc);           // crc32

        $cdrec .= pack('V', $c_len);         // compressed filesize

        $cdrec .= pack('V', $unc_len);       // uncompressed filesize

        $cdrec .= pack('v', strlen($name) ); // length of filename

        $cdrec .= pack('v', 0 );             // extra field length

        $cdrec .= pack('v', 0 );             // file comment length

        $cdrec .= pack('v', 0 );             // disk number start

        $cdrec .= pack('v', 0 );             // internal file attributes

        $cdrec .= pack('V', 32 );            // external file attributes - 'archive' bit set

        $cdrec .= pack('V', $this -> old_offset ); // relative offset of local header

        $this -> old_offset = $new_offset;

        $cdrec .= $name;

        // optional extra field, file comment goes here

        // save to central directory

        $this -> ctrl_dir[] = $cdrec;

    } // end of the 'addFile()' method

    /**

     * Dumps out file

     *

     * @return  string  the zipped file

     *

     * @access public

     */

    function file()

    {

        $data    = implode('', $this -> datasec);

        $ctrldir = implode('', $this -> ctrl_dir);

        return

            $data .

            $ctrldir .

            $this -> eof_ctrl_dir .

            pack('v', sizeof($this -> ctrl_dir)) .  // total # of entries "on this disk"

            pack('v', sizeof($this -> ctrl_dir)) .  // total # of entries overall

            pack('V', strlen($ctrldir)) .           // size of central dir

            pack('V', strlen($data)) .              // offset to start of central dir

            "x00x00";                             // .zip file comment length

    } // end of the 'file()' method

} // end of the 'PHPZip' class

?>

关于php实现crc冗余算法的验证和补全问题

首先,要纠正一个概念上的错误,CRC算法是用来验证完整性的算法,它并不能提供错误修复的能力。

如果需要在PHP中使用CRC算法,可以直接使用PHP中的crc32函数。有关此函数的使用,可以参考以下链接:

如果需要在接收端进行错误的修复,则需要使用某种前向错误修正算法,比如里德-索罗门算法等,这些算法在PHP库中好像没有实现。相关的资料可以查看:

关于php文件crc的介绍到此就结束了,不知道本篇文章是否对您有帮助呢?如果你还想了解更多此类信息,记得收藏关注本站,我们会不定期更新哦。

查看更多关于php文件crc PHP文件管理系统的详细内容...

声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did197688
更新时间:2023-04-26   阅读:19次

上一篇: php图书界面框架 php图表框架

下一篇:phpsocket接口 php socket_write

相关资讯

最新资料更新

  • 1.php翻译sdk php翻译成中文是什么意思
  • 2.php保存url数据 php获取url参数
  • 3.phphint插件下载 php 插件系统
  • 4.phpzend加密过期 php加密解密
  • 5.linux中下载php linux安装php56
  • 6.php客户信息管理 php用户管理
  • 7.php环境配置工具 phpstorm2021配置php环境
  • 8.php网络通信 php通信协议
  • 9.php变下载文件 php 下载文件
  • 10.php余数1 php math
  • 11.php短信被刷 php防止短信被刷
  • 12.php暂停方法 php 停止执行
  • 13.主流php框架比较 php框架排行2020
  • 14.php写循环下拉页面 php下拉菜单的代码
  • 15.php学费多少兄弟连 php教程兄弟连
  • 16.如何阅读php源码 php在线源码获取
  • 17.php受不受欢迎 php无法接收post
  • 18.phpoutfile的简单介绍
  • 19.php代理访问源码 php 代理
  • 20.php移动gps定位 functionsphp位置

CopyRight:2016-2025好得很程序员自学网 备案ICP:湘ICP备09009000号-16 http://haodehen.cn
本站资讯不构成任何建议,仅限于个人分享,参考须谨慎!
本网站对有关资料所引致的错误、不确或遗漏,概不负任何法律责任。
本网站刊载的所有内容(包括但不仅限文字、图片、LOGO、音频、视频、软件、程序等)版权归原作者所有。任何单位或个人认为本网站中的内容可能涉嫌侵犯其知识产权或存在不实内容时,请及时通知本站,予以删除。

网站内容来源于网络分享,如有侵权发邮箱到:kenbest@126.com,收到邮件我们会即时下线处理。
网站框架支持:HDHCMS   51LA统计 百度统计
Copyright © 2018-2025 「好得很程序员自学网」
[ SiteMap ]