Phar::loadPhar

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

Phar::loadPharLoads any phar archive with an alias

Beschreibung

final public static Phar::loadPhar(string $filename, ?string $alias = null): bool

This can be used to read the contents of an external Phar archive. This is most useful for assigning an alias to a phar so that subsequent references to the phar can use the shorter alias, or for loading Phar archives that only contain data and are not intended for execution/inclusion in PHP scripts.

Parameter-Liste

filename

the full or relative path to the phar archive to open

alias

The alias that may be used to refer to the phar archive. Note that many phar archives specify an explicit alias inside the phar archive, and a PharException will be thrown if a new alias is specified in this case.

Rückgabewerte

Gibt bei Erfolg true zurück. Bei einem Fehler wird false zurückgegeben.

Fehler/Exceptions

PharException is thrown if an alias is passed in and the phar archive already has an explicit alias

Beispiele

Beispiel #1 A Phar::loadPhar() example

Phar::loadPhar can be used anywhere to load an external Phar archive, whereas Phar::mapPhar should be used in a loader stub for a Phar.

<?php
try {
    
Phar::loadPhar('/path/to/phar.phar''my.phar');
    echo 
file_get_contents('phar://my.phar/file.txt');
} catch (
PharException $e) {
    echo 
$e;
}
?>

Siehe auch

  • Phar::mapPhar() - Reads the currently executed file (a phar) and registers its manifest

Hier Kannst Du einen Kommentar verfassen


Bitte gib mindestens 10 Zeichen ein.
Wird geladen... Bitte warte.
* Pflichtangabe
Es sind noch keine Kommentare vorhanden.

Was genau bedeutet "Vibe Coding"? Ein tiefgehender Blick für Entwickler

In der Welt der Softwareentwicklung gibt es unzählige Wege, wie man an ein Projekt herangeht. Manche schwören auf strikte Planung, andere auf bewährte Algorithmen und wieder andere lassen sich von etwas ganz anderem leiten: ihrem Gefühl. ...

admin

Autor : admin
Kategorie: Software & Web-Development

PHP cURL-Tutorial: Verwendung von cURL zum Durchführen von HTTP-Anfragen

cURL ist eine leistungsstarke PHP-Erweiterung, die es Ihnen ermöglicht, mit verschiedenen Servern über verschiedene Protokolle wie HTTP, HTTPS, FTP und mehr zu kommunizieren. ...

TheMax

Autor : TheMax
Kategorie: PHP-Tutorials

Midjourney Tutorial - Anleitung für Anfänger

Über Midjourney, dem Tool zur Erstellung digitaler Bilder mithilfe von künstlicher Intelligenz, gibt es ein informatives Video mit dem Titel "Midjourney Tutorial auf Deutsch - Anleitung für Anfänger" ...

Mike94

Autor : Mike94
Kategorie: KI Tutorials

Tutorial veröffentlichen

Tutorial veröffentlichen

Teile Dein Wissen mit anderen Entwicklern weltweit

Du bist Profi in deinem Bereich und möchtest dein Wissen teilen, dann melde dich jetzt an und teile es mit unserer PHP-Community

mehr erfahren

Tutorial veröffentlichen

aleplon Cheap. Zaleplon no prescription - Watch Buy Zaleplon No Prescription. Chelms

Cheap Zaleplon. Zaleplon no prescription Need quality meds without the hassle? Our online pharmacy is here to help! Browse a wide range of top-not ...

Geschrieben von drawer am 19.06.2026 09:36:42
Forum: Ankündigungen
tromectol Preiswert kaufen. Stromectol Kaufen Sie uns AMEX - Stromectol kaufen in De

Preiswert kaufen Stromectol. Stromectol Kaufen Sie uns AMEX Sie suchen erstklassige Medikamente, ohne das Haus zu verlassen? Suchen Sie nicht weit ...

Geschrieben von drawer am 19.06.2026 09:36:02
Forum: Fragen/Vorschläge zum Forum
roxatral Korting. Uroxatral Geen ontvangen mastercarde geaccepteerd - Merk zonder re

Korting Uroxatral. Uroxatral Geen ontvangen mastercarde geaccepteerd Heeft u betrouwbare medicijnen van hoge kwaliteit nodig, maar wilt u niet de ...

Geschrieben von travelder am 19.06.2026 09:35:23
Forum: Projekthilfe
ildenafil Without recipe. Buy Sildenafil Over The Counter Online - Buy Sildenafil on

Without recipe Sildenafil. Buy Sildenafil Over The Counter Online Do you need reliable, high-quality medications, but don't want to leave home to ...

Geschrieben von drawer am 19.06.2026 09:35:13
Forum: Ankündigungen