【问题标题】:How to identify whether the PHP file is Encoded or not using the Zend Guard loader如何使用 Zend Guard 加载器识别 PHP 文件是否已编码
【发布时间】:2015-03-07 11:14:52
【问题描述】:

去年,我通过使用 Zend Guard Loader PHP 扩展对所有文件进行编码,在客户端服务器中部署了一个项目,部署后,我们根据客户端电子邮件进行了一些快速更改/修复,并在实时服务器上部署了未编码的文件作为紧急事项,我们在部署后做了很多次,所以现在我处于一个阶段,我没有在实时服务器上未编码的情况下部署的文件列表。

现在客户今年将通过进一步集成需要对当前解决方案产生重大影响的新模块来升级解决方案。因此,在继续进行新模块集成之前,我想生成一份报告,说明当前部署在实时服务器上的文件是什么而没有编码。

现在进入技术讨论,我在 Google 中搜索并找到了一种解决方案,我们可以使用 Zend Guard Loader - PHP API 检查文件是否已编码。 (http://files.zend.com/help/Zend-Server-5/zend_guard_loader_-_php_api.htm)

API 提供了一个函数boolean zend_loader_file_encoded (void),但实际上这个函数不接受任何参数,因为它总是检查当前文件是否使用 Zend 保护加密。 p>

基本上我想在服务器上浏览每个文件夹和其中的更多文件,以检查它是否已编码。

期待你进一步的方向。

【问题讨论】:

  • 这样的zend保护编码文件看起来如何?
  • 内容看起来像

标签: php zend-framework encoding zend-guard


【解决方案1】:

需要递归检查不以<?php @Zend;开头的php文件:

$directory = new \RecursiveDirectoryIterator($path);
$iterator = new \RecursiveIteratorIterator($directory);
$files = array();
foreach ($iterator as $info) {
  if (substr($info->getPathname(), -4) === '.php') {
    $f = fopen($info->getPathname(), 'r');
    $bytes = fgets($f, 12);
    fclose($f);
    if($bytes !== '<?php @Zend;') {
      $files[] = $info->getPathname();
    }
  }
}

【讨论】:

    猜你喜欢
    • 2013-06-16
    • 2011-10-07
    • 2011-05-16
    • 1970-01-01
    • 1970-01-01
    • 2014-12-02
    • 2013-01-20
    • 1970-01-01
    • 2015-11-11
    相关资源
    最近更新 更多