Created
August 4, 2020 10:57
-
-
Save PJZ9n/6962f8e9f632c7578ac8ba8f732c4543 to your computer and use it in GitHub Desktop.
zipをpharから読み出すテスト
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//phar://path/to/resources/test.zip | |
$path = $this->getFile() . "resources/test.zip"; | |
echo "path: "; | |
var_dump($path); | |
//本当にファイルが存在するのかの確認 | |
echo "content-length10(base64): "; | |
var_dump(base64_encode(substr(file_get_contents($path), 0, 10))); | |
//zip | |
$zip = new \ZipArchive(); | |
$result = $zip->open($path); | |
echo "zip open result: "; | |
//成功した場合はtrue、それ以外はエラーコード | |
var_dump($result); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment