本文整理匯總了PHP中Phar::offsetSet方法的典型用法代碼示例。如果您正苦於以下問題:PHP Phar::offsetSet方法的具體用法?PHP Phar::offsetSet怎麽用?PHP Phar::offsetSet使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Phar
的用法示例。
在下文中一共展示了Phar::offsetSet方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: catch
$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) {
echo $e->getMessage() . "\n";
}
示例2: offsetSet
function offsetSet($k, $v)
{
$this->addFileToHash($v);
parent::offsetSet($k, $v);
}
示例3: catch
$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()));
try {
$phar->offsetSet('.phar/alias.txt', 'dolly');
} catch (Exception $e) {
echo $e->getMessage() . "\n";
}