本文整理匯總了PHP中Phar::__construct方法的典型用法代碼示例。如果您正苦於以下問題:PHP Phar::__construct方法的具體用法?PHP Phar::__construct怎麽用?PHP Phar::__construct使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Phar
的用法示例。
在下文中一共展示了Phar::__construct方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: elseif
/**
* Open a PHAR archive. If it does not exist, attempt to create it.
*
* @param string $filename Filename (see original documentation).
* @param int $flags Flags (see original documentation).
* @param string $alias Alias (see original documentation).
* @return void
*/
function __construct($filename, $flags = null, $alias = null)
{
if (null !== $alias) {
parent::__construct($filename, $flags, $alias);
} elseif (null !== $flags) {
parent::__construct($filename, $flags);
} else {
parent::__construct($filename);
}
$this->setSignatureAlgorithm(static::SHA1);
$this->setMetadata(['author' => 'fruux GmbH (https://fruux.com/)', 'license' => 'Modified BSD License (http://sabre.io/license/)', 'copyright' => 'Copyright (C) 2015 fruux GmbH (https://fruux.com/)', 'datetime' => date('c')]);
}
示例2: Phar
<?php
require_once 'files/phar_oo_test.inc';
$phar = new Phar($fname);
var_dump($phar->getVersion());
var_dump(count($phar));
class MyPhar extends Phar
{
function __construct()
{
}
}
try {
$phar = new MyPhar();
var_dump($phar->getVersion());
} catch (LogicException $e) {
var_dump($e->getMessage());
}
try {
$phar = new Phar('test.phar');
$phar->__construct('oops');
} catch (LogicException $e) {
var_dump($e->getMessage());
}
?>
===DONE===
<?php
unlink(dirname(__FILE__) . '/files/phar_oo_001.phar.php');
__halt_compiler();
?>
示例3:
function __construct($fname, $flags)
{
parent::__construct($fname, $flags);
$this->hash = null;
}