当前位置: 首页>>代码示例>>PHP>>正文


PHP PharData::getSignature方法代码示例

本文整理汇总了PHP中PharData::getSignature方法的典型用法代码示例。如果您正苦于以下问题:PHP PharData::getSignature方法的具体用法?PHP PharData::getSignature怎么用?PHP PharData::getSignature使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PharData的用法示例。


在下文中一共展示了PharData::getSignature方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: dirname

include dirname(__FILE__) . '/files/tarmaker.php.inc';
$fname = dirname(__FILE__) . '/tar_004.phar.tar';
$alias = 'phar://' . $fname;
$fname2 = dirname(__FILE__) . '/tar_004.tar';
$tar = new tarmaker($fname, 'none');
$tar->init();
$tar->addFile('tar_004.php', '<?php var_dump(__FILE__);');
$tar->addFile('internal/file/here', "hi there!\n");
$tar->addFile('.phar/stub.php', "__HALT_COMPILER();");
$tar->close();
try {
    $phar = new Phar($fname);
    var_dump($phar->getStub());
} catch (Exception $e) {
    echo $e->getMessage() . "\n";
}
ini_set('phar.require_hash', 0);
try {
    $phar = new PharData($fname2);
    $phar['file'] = 'hi';
    var_dump($phar->getSignature());
    $phar->setSignatureAlgorithm(Phar::MD5);
    var_dump($phar->getSignature());
} catch (Exception $e) {
    echo $e->getMessage() . "\n";
}
?>
===DONE===
<?php 
@unlink(dirname(__FILE__) . '/tar_004.phar.tar');
@unlink(dirname(__FILE__) . '/tar_004.tar');
开发者ID:alphaxxl,项目名称:hhvm,代码行数:31,代码来源:require_hash.php

示例2: toTar

 function toTar()
 {
     if (isset($this->tar)) {
         return;
     }
     if (isset($this->tgz)) {
         if (file_exists($this->file . '.tar')) {
             try {
                 $p = new \PharData($this->file . '.tar');
             } catch (\Exception $e) {
             }
             if ($p->getSignature() === $this->phar->getSignature()) {
                 $this->tar = $p;
                 if ($this->outfile) {
                     copy($this->file . '.tar', $this->outfile . '.tar');
                 }
                 return;
             }
             unset($p);
             \Phar::unlinkArchive($this->file . '.tar');
         }
         $fp = gzopen($this->file . '.tgz', 'rb');
         $gp = fopen($this->file . '.tar', 'wb');
         stream_copy_to_stream($fp, $gp);
         fclose($fp);
         fclose($gp);
         $this->tar = new \PharData($this->file . '.tar');
         return;
     }
     if (isset($this->zip)) {
         if (file_exists($this->file . '.tar')) {
             \Phar::unlinkArchive($this->file . '.tar');
         }
         $this->tar = $this->zip->convertToData(\Phar::TAR, \Phar::NONE, $this->ext . '.tar');
         $this->tar->setSignatureAlgorithm(\Phar::SHA1);
         if ($this->outfile) {
             copy($this->file . '.tar', $this->outfile . '.tar');
         }
         $this->zip = new \PharData($this->file . '.zip');
         return;
     }
     // by process of elimination, the phar is in phar format
     if (file_exists($this->file . '.tar')) {
         \Phar::unlinkArchive($this->file . '.tar');
     }
     $this->tar = $this->phar->convertToData(\Phar::TAR, \Phar::NONE, $this->ext . '.tar');
     $this->tar->setSignatureAlgorithm(\Phar::SHA1);
     if ($this->outfile) {
         copy($this->file . '.tar', $this->outfile . '.tar');
     }
     $this->phar = new \Phar($this->file . '.phar');
 }
开发者ID:peopleplan,项目名称:Pyrus,代码行数:52,代码来源:Cloner.php


注:本文中的PharData::getSignature方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。