PHP Doku:: Returns the full path on disk or full phar URL to the currently executing Phar archive - phar.running.html

Verlauf / Chronik / History: (1) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzErweiterungen zur Datenkompression und ArchivierungPharThe Phar classPhar::running

Ein Service von Reinhard Neidl - Webprogrammierung.

The Phar class

<<Phar::offsetUnset

Phar::setAlias>>

Phar::running

(PHP >= 5.3.0, PECL phar >= 2.0.0)

Phar::runningReturns the full path on disk or full phar URL to the currently executing Phar archive

Beschreibung

string Phar::running ([ bool $retphar = true ] )

Returns the full path to the running phar archive. This is intended for use much like the __FILE__ magic constant, and only has effect inside an executing phar archive.

Inside the stub of an archive, Phar::running() returns "". Simply use __FILE__ to access the current running phar inside a stub.

Parameter-Liste

retphar

If FALSE, the full path on disk to the phar archive is returned. If TRUE, a full phar URL is returned.

Rückgabewerte

Returns the filename if valid, empty string otherwise.

Beispiele

Beispiel #1 A Phar::running() example

For the following example, assume the file is within phar archive /path/to/phar/my.phar and the file is located at path my/file.txt within the phar archive.

<?php
$a 
Phar::running(); // $a is "phar:///path/to/my.phar"
$b Phar::running(false); // $b is "/path/to/my.phar"
?>


Keine BenutzerBeiträge.
- Beiträge aktualisieren...



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)