downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

PharData::offsetUnset> <PharData::isWritable
[edit] Last updated: Fri, 17 May 2013

view this page in

PharData::offsetSet

(PHP >= 5.3.0, PECL phar >= 2.0.0)

PharData::offsetSetEstablecer el contenido de un fichero dentro de un tar/zip a aquel de un fichero o cadena externos

Descripción

void PharData::offsetSet ( string $offset , string $value )

Ésta es una implementación de la interfaz ArrayAccess que permite la manipulación directa del contenido de un archivo tar/zip utilizando los corchetes de acceso al array. offsetSet se utiliza para modificar un fichero existente, o añadir un nuevo fichero al archivo tar/zip.

Parámetros

offset

El nombre del fichero (ruta relativa) a modificar en un archivo tar o zip.

value

El contenido del fichero.

Valores devueltos

No devuelve ningún valor.

Errores/Excepciones

Lanza un excepción de tipo PharException si existe cualquier problema volcando los cambios hechos al archivo tar/zip al disco.

Ejemplos

Ejemplo #1 Un ejemplo de PharData::offsetSet()

No se debería acceder directamente a offsetSet, en su lugar se utiliza el operador [] para acceder al array.

<?php
$p 
= new PharData('/ruta/a/mi.phar'0'mi.phar');
try {
    
// llama a offsetSet
    
$p['fichero.txt'] = 'Hola qué tal';
} catch (
Exception $e) {
    echo 
'No se pudo modificar fichero.txt:'$e;
}
?>

Ver también

  • Phar::offsetSet() - Establecer el contenido de un fichero interno a aquel de un fichero externo



add a note add a note User Contributed Notes PharData::offsetSet - [0 notes]
There are no user contributed notes for this page.

 
show source | credits | sitemap | contact | advertising | mirror sites