Phar::offsetExists

(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 1.0.0)

Phar::offsetExists — 파일이 phar에 존재하는지 확인합니다.


설명

public Phar::offsetExists(string $localName): bool

이것은 배열 액세스 브래킷을 사용하여 Phar 아카이브의 내용을 직접 조작할 수 있는 ArrayAccess 인터페이스의 구현입니다.

offsetExists()는 isset()이 호출될 때마다 호출됩니다.


매개변수

localName
Phar에서 찾을 파일 이름(상대 경로)입니다.

반환 값

파일이 phar 내에 있으면 true를 반환하고, 없으면 false를 반환합니다.


Examples

예제 #1 Phar::offsetExists() 예제

                  
<?php
$p = new Phar(dirname(__FILE__) . '/my.phar', 0, 'my.phar');
$p['firstfile.txt'] = 'first file';
$p['secondfile.txt'] = 'second file';
// the next set of lines call offsetExists() indirectly
var_dump(isset($p['firstfile.txt']));
var_dump(isset($p['nothere.txt']));
?>
                  
                

위의 예는 다음을 출력합니다.

bool(true)
bool(false)
                

기타