Phar::setDefaultStub

(Unknown)

Phar::setDefaultStubUsed to set the PHP loader or bootstrap stub of a Phar archive to the default loader

说锟斤拷

public Phar::setDefaultStub ([ string $index [, string $webindex ]] ) : bool

Note:

锟剿凤拷锟斤拷锟斤拷要 锟斤拷 php.ini 锟叫碉拷 phar.readonly 锟斤拷为 0 锟斤拷锟绞猴拷 Phar 锟斤拷锟斤拷. 锟斤拷锟斤拷, 锟斤拷锟阶筹拷PharException.

This method is a convenience method that combines the functionality of Phar::createDefaultStub() and Phar::setStub().

锟斤拷锟斤拷

index

Relative path within the phar archive to run if accessed on the command-line

webindex

Relative path within the phar archive to run if accessed through a web browser

锟斤拷锟斤拷值

锟缴癸拷时锟斤拷锟斤拷 TRUE锟斤拷 锟斤拷锟斤拷锟斤拷失锟斤拷时锟斤拷锟斤拷 FALSE锟斤拷

锟斤拷锟斤拷锟届常

UnexpectedValueException is thrown if phar.readonly is enabled in php.ini. PharException is thrown if any problems are encountered flushing changes to disk.

锟斤拷锟斤拷

Example #1 A Phar::setDefaultStub() example

<?php
try {
    
$phar = new Phar('myphar.phar');
    
$phar->setDefaultStub('cli.php''web/index.php');
    
// this is the same as:
    // $phar->setStub($phar->createDefaultStub('cli.php', 'web/index.php'));
} catch (Exception $e) {
    
// handle errors
}
?>

锟轿硷拷