您好,登錄后才能下訂單哦!
[Phar]
phar.readonly = Off
<?php
$exts = array(
'*',
);
$dir = __DIR__;
$file = 'test.phar';
$phar = new Phar(__DIR__ . '/' . $file, FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::KEY_AS_FILENAME, $file);
$phar->startBuffering();
foreach ($exts as $ext) {
$phar->buildFromDirectory($dir, '/\.' . $ext . '$/');
}
$phar->delete('build.php');
$phar->setStub($phar->createDefaultStub('index.php'));
$phar->stopBuffering();
echo "打包完成".PHP_EOL;
b. 執行壓縮腳本:
php /home/lee/php/compress.php
c. 查看壓縮包:
ll /home/lee/php
<?php
define('ROOT',__DIR__);
$dir = ROOT.'/extract';
if(!is_dir($dir)){
@mkdir($dir);
}
$phar = new Phar(ROOT.'/test.phar');
$phar->extractTo($dir,null,true);
echo "解壓完成".PHP_EOL;
b. 執行解壓腳本:
php /home/lee/php/depress.php
c. 查看解壓文件:
ll /home/lee/php/extract
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。