PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Phar::getSupportedCompression> <Phar::getSignature
Last updated: Fri, 05 Sep 2008

view this page in

Phar::getStub

(PECL phar:1.0.0-1.2.1)

Phar::getStubPhar アーカイブの PHP ローダーあるいは起動スタブを返す

説明

string Phar::getStub ( void )

Phar アーカイブには、ブートストラップローダー (あるいは スタブ) というものが含まれています。これは PHP で書かれており、 そのアーカイブを PHP から実行したときに最初に実行されます。 たとえば次のようにインクルードしたり、

<?php
include 'myphar.phar';
?>
あるいは単純に実行したりなどした場合です。
    
php myphar.phar
    

返り値

現在の Phar アーカイブの起動用ローダー (スタブ) の内容を文字列で返します。

エラー / 例外

スタブを Phar アーカイブから読み込めない場合に RuntimeException をスローします。

例1 Phar::getStub() の例

$p = new Phar('/path/to/my.phar', 0, 'my.phar');
echo $p->getStub();
echo "==NEXT==\n";
$p->setStub("<?php
function __autoload($class)
{
    include 
'phar://' str_replace('_''/'$class);
}
Phar::mapPhar('myphar.phar');
include 
'phar://myphar.phar/startup.php';
__HALT_COMPILER(); 
?>");
echo $p->getStub();

上の例の出力は以下となります。

<?php __HALT_COMPILER(); ?>
==NEXT==
<?php
function __autoload($class)
{
    include 'phar://' . str_replace('_', '/', $class);
}
Phar::mapPhar('myphar.phar');
include 'phar://myphar.phar/startup.php';
__HALT_COMPILER(); ?>



add a note add a note User Contributed Notes
Phar::getStub
There are no user contributed notes for this page.

Phar::getSupportedCompression> <Phar::getSignature
Last updated: Fri, 05 Sep 2008
 
 
show source | credits | sitemap | contact | advertising | mirror sites