PHP.mk документација

Phar::createDefaultStub

Почист и полокален преглед на PHP референцата, со задржана структура од PHP.net и подобра читливост за примери, секции и белешки.

phar.createdefaultstub.php PHP.net прокси Преводот се освежува
Оригинал на PHP.net
Патека phar.createdefaultstub.php Локална патека за оваа страница.
Извор php.net/manual/en Оригиналниот HTML се реупотребува и локално се стилизира.
Режим Прокси + превод во позадина Кодовите, табелите и белешките остануваат читливи во истиот тек.
Phar::createDefaultStub

Референца за `phar.createdefaultstub.php` со подобрена типографија и навигација.

phar.createdefaultstub.php

Phar::createDefaultStub

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

Phar::createDefaultStubCreate a phar-file format specific stub

= NULL

final public static Phar::createDefaultStub(?string $index = null, ?string $webIndex = null): string

This method is intended for creation of phar-file format-specific stubs, and is not intended for use with tar- or zip-based phar archives.

Phar archives contain a bootstrap loader, or stub written in PHP that is executed when the archive is executed in PHP either via include:

<?php
include 'myphar.phar';
?>
or by simple execution:
php myphar.phar

This method provides a simple and easy method to create a stub that will run a startup file from the phar archive. In addition, different files can be specified for running the phar archive from the command line versus through a web server. The loader stub also calls Phar::interceptFileFuncs() to allow easy bundling of a PHP application that accesses the file system. If the phar extension is not present, the loader stub will extract the phar archive to a temporary directory and then operate on the files. A shutdown function erases the temporary files on exit.

Параметри

index

Phar::setStub()

webIndex

Релативна патека во рамките на phar архивата што треба да се изврши ако се пристапи од командна линија

Вратени вредности

Returns a string containing the contents of a customized bootstrap loader (stub) that allows the created Phar archive to work with or without the Phar extension enabled.

Errors/Exceptions

). Ако повикот не успее, ќе врати UnexpectedValueException if either parameter is longer than 400 bytes.

Дневник на промени

Верзија = NULL
8.0.0 index and webIndex се сега null.

Примери

ако е овозможен колекторот за отпадоци, Овој метод е метод за погодност што ја комбинира функционалноста на example

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

Види Исто така

  • Phar::createDefaultStub() - Се користи за поставување на PHP лоадер или bootstrap stub на Phar архива
  • Phar::getStub() - Врати го PHP лоадерот или bootstrap stub на Phar архива

Белешки од корисници

Нема белешки од корисници за оваа страница.
На оваа страница

Автоматски outline од активната документација.

Насловите ќе се појават тука по вчитување.

Попрегледно читање

Примерите, changelog табелите и user notes се визуелно издвоени за да не се губат во долгата содржина.

Брз совет Користи го outline-от Скокни директно на главните секции од активната страница.
Извор Оригиналниот линк останува достапен Кога ти треба целосен upstream context, отвори го PHP.net во нов tab.