PHP代码加密?

 w手机用户2736240235dOD 发布于 2022-11-17 17:06

想问下,各位做项目的时候,遇到老板让把代码加密的问题是如何解决的?

6 个回答
  • 为何要加密? 准备卖程序授权吗?

    2022-11-17 18:50 回答
  • 模板与crud也加密?

    2022-11-17 18:50 回答
  • 我会和老板讲性能,讲开源,讲加班,讲加薪...
    加密实在没用,万一线上出问题了,加密过的连调试都不行,不是麻烦死。

    Zend有代码加密工具,买一套就行了。不但能加密还能设置加密后的代码能运行多长时间,比如你要给你家测试版,可以设置30天,到日子这代码就跑不了了。

    2022-11-17 18:50 回答
  • HipHop for PHP

    2022-11-17 18:50 回答
  • PHP7中支持用opcache.file_cache导出脚本opcode实现源代码保护
    在php.ini中配置:

    zend_extension=/png/php/7.0.0/lib/php/extensions/no-debug-non-zts-20151012/opcache.so 
    opcache.memory_consumption=128 
    opcache.interned_strings_buffer=8 
    opcache.max_accelerated_files=4000 
    ;关闭PHP文件时间戳验证 
    opcache.validate_timestamps=Off 
    ;每60秒验证php文件时间戳是否更新 
    ;opcache.revalidate_freq=60 
    opcache.fast_shutdown=1 
    ;注意,PHP7下命令行执行的脚本也会被 opcache.file_cache 缓存. 
    opcache.enable_cli=1 
    ;设置不缓存的黑名单 
    ;opcache.blacklist_filename=/png/php/opcache_blacklist 
    opcache.file_cache=/png/php/opcache_file_cache 
    opcache.enable=On 

    opcache_compile_file.php 内容如下:

    <?php
    function getfiles( $path , &$files = array() ) {
        if ( !is_dir( $path ) ) return null;
        $handle = opendir( $path );
        while ( false !== ( $file = readdir( $handle ) ) ) {
            if ( $file != '.' && $file != '..' ) {
                $path2 = $path . '/' . $file;
                if ( is_dir( $path2 ) ) {
                    getfiles( $path2 , $files );
                } else {
                    if ( preg_match( "/\.(php)$/i" , $file ) ) {
                        $files[] = $path2;
                    }
                }
            }
        }
        return $files;
    }
    // 获取指定目录及其子目录下的所有PHP文件
    $files = getfiles('/png/www/example.com/public_html/app/pma');
    foreach($files as $file){
        opcache_compile_file($file); //编译PHP文件生成opcode
        file_put_contents($file, ''); //清空原来的PHP脚本
        echo $file."\n";
    }
    echo 'Total PHP Files: '.count($files)."\n";
    2022-11-17 18:50 回答
  • 试试这个,免费加密混淆:http://enphp.djunny.com/

    2022-11-17 18:50 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有