本文整理汇总了PHP中Phar::offsetGet方法的典型用法代码示例。如果您正苦于以下问题:PHP Phar::offsetGet方法的具体用法?PHP Phar::offsetGet怎么用?PHP Phar::offsetGet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phar
的用法示例。
在下文中一共展示了Phar::offsetGet方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: catch
echo $e->getMessage() . "\n";
}
$a->compressFiles(array());
try {
$a->decompressFiles();
} catch (Exception $e) {
echo $e->getMessage() . "\n";
}
$a->copy(array());
try {
$a->copy('a', 'b');
} catch (Exception $e) {
echo $e->getMessage() . "\n";
}
$a->offsetExists(array());
$a->offsetGet(array());
ini_set('phar.readonly', 0);
$a->offsetSet(array());
ini_set('phar.readonly', 1);
$b->offsetUnset(array());
try {
$a->offsetUnset('a');
} catch (Exception $e) {
echo $e->getMessage() . "\n";
}
$a->addEmptyDir(array());
$a->addFile(array());
$a->addFromString(array());
try {
$a->setMetadata('a');
} catch (Exception $e) {
示例2: Phar
<?php
$x = new Phar(__DIR__ . '/basic.phar');
$obj = $x->offsetGet('index.php');
var_dump(get_class($obj));
var_dump($obj->getFilename());
var_dump($obj->getSize());
var_dump($obj->getExtension());
示例3: dirname
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$phar = new Phar($fname);
$phar->setDefaultStub();
$phar->setAlias('susan');
$phar['a.txt'] = "first file\n";
$phar['b.txt'] = "second file\n";
try {
$phar->offsetGet('.phar/stub.php');
} catch (Exception $e) {
echo $e->getMessage() . "\n";
}
try {
$phar->offsetGet('.phar/alias.txt');
} catch (Exception $e) {
echo $e->getMessage() . "\n";
}
try {
$phar->offsetSet('.phar/stub.php', '<?php __HALT_COMPILER(); ?>');
} catch (Exception $e) {
echo $e->getMessage() . "\n";
}
var_dump(strlen($phar->getStub()));
try {
$phar->offsetUnset('.phar/stub.php');
} catch (Exception $e) {
echo $e->getMessage() . "\n";
}
var_dump(strlen($phar->getStub()));