Phar::running

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

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

说明

final public static Phar::running ([ bool $retphar = TRUE ] ) : string

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.

参数

retphar

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

返回值

Returns the filename if valid, empty string otherwise.

范例

Example #1 A Phar::running() example

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

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

相关文章
php mysqlnd ms 函数 returns a list of currently configured serversphp imagickdraw returns the interpretation of clip path unitsphp phar convert a phar archive to a non executable tar or zip filephp phar convert a phar archive to another executable phar archive file formatphp phar copy a file internal to the phar archive to another new file within the pharphp phar returns the number of entries files in the phar archivephp phar returns phar archive meta dataphp phar get the real path to the phar archive on diskphp phar used to determine whether phar write operations are being buffered or are flushing directly to diskphp phar returns phar gz or phar bz2 if the entire phar archive is compressed .tar.gz/tar.bz and so on php phar returns true if the phar archive is based on the tar/phar/zip file format depending on the parameterphp phar returns true if the phar archive can be modifiedphp phar mount an external path or file to a virtual location within the phar archivephp phar returns the full path on disk or full phar url to the currently executing phar archivephp phar stop buffering write requests to the phar archive and save changes to diskphp phar completely remove a phar archive from disk and from memoryphp phardata returns true if the tar/zip archive can be modifiedphp pharfileinfo returns the actual size of the file with compression inside the phar archivephp solrresponse returns the full url the request was sent tophp ziparchive adds a file to a zip archive from the given path
关注编程学问公众号