php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
fopen.php
Go to the documentation of this file.
1<?php
2if (!extension_loaded('zip')) {
3 dl('zip.so');
4}
5
6
7$fp = fopen('zip://' . dirname(__FILE__) . '/test.zip#test', 'r');
8if (!$fp) {
9 exit("cannot open\n");
10}
11while (!feof($fp)) {
12 $contents .= fread($fp, 2);
13 echo "$contents\n";
14}
15
16fclose($fp);
17echo "done.\n";
18
19
21$z = new ZipArchive();
22$z->open(dirname(__FILE__) . '/test.zip');
23$fp = $z->getStream('test');
24
26if(!$fp) exit("\n");
27while (!feof($fp)) {
28 $contents .= fread($fp, 2);
29}
30
31fclose($fp);
32file_put_contents('t',$contents);
33echo "done.\n";
$z
Definition addglob.php:3
feof($stream)
file_put_contents(string $filename, mixed $data, int $flags=0, $context=null)
dirname(string $path, int $levels=1)
fclose($stream)
var_dump(mixed $value, mixed ... $values)
fopen(string $filename, string $mode, bool $use_include_path=false, $context=null)
fread($stream, int $length)
dl(string $extension_filename)
Definition dl.stub.php:3
if(!extension_loaded('zip')) $fp
Definition fopen.php:7
$content
Definition fopen.php:20
exit(string|int $status=0)
extension_loaded(string $extension)