<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://es.wikieducator.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="es">
		<id>https://es.wikieducator.org/index.php?action=history&amp;feed=atom&amp;title=Usuario%3ALmorillas%2Fdesarrollo_web_servidor%2Fphp%2Fficheros</id>
		<title>Usuario:Lmorillas/desarrollo web servidor/php/ficheros - Historial de revisiones</title>
		<link rel="self" type="application/atom+xml" href="https://es.wikieducator.org/index.php?action=history&amp;feed=atom&amp;title=Usuario%3ALmorillas%2Fdesarrollo_web_servidor%2Fphp%2Fficheros"/>
		<link rel="alternate" type="text/html" href="https://es.wikieducator.org/index.php?title=Usuario:Lmorillas/desarrollo_web_servidor/php/ficheros&amp;action=history"/>
		<updated>2026-06-19T15:45:09Z</updated>
		<subtitle>Historial de revisiones para esta página en el wiki</subtitle>
		<generator>MediaWiki 1.23.14</generator>

	<entry>
		<id>https://es.wikieducator.org/index.php?title=Usuario:Lmorillas/desarrollo_web_servidor/php/ficheros&amp;diff=14269&amp;oldid=prev</id>
		<title>Lmorillas en 09:18 21 ene 2014</title>
		<link rel="alternate" type="text/html" href="https://es.wikieducator.org/index.php?title=Usuario:Lmorillas/desarrollo_web_servidor/php/ficheros&amp;diff=14269&amp;oldid=prev"/>
				<updated>2014-01-21T09:18:06Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Revisión anterior&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revisión de 09:18 21 ene 2014&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Línea 6:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Línea 6:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|Title=Documentación}}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|Title=Documentación}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;== Abrir archivos ==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;?php&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;if ( !($fp = fopen(&amp;quot;myfile.txt&amp;quot;, &amp;quot;r&amp;quot;) ) )&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;exit(&amp;quot;Unable to open the input file.&amp;quot;);&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;?&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/source&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Lectura de un archivo ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Lectura de un archivo ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Lmorillas</name></author>	</entry>

	<entry>
		<id>https://es.wikieducator.org/index.php?title=Usuario:Lmorillas/desarrollo_web_servidor/php/ficheros&amp;diff=14268&amp;oldid=prev</id>
		<title>Lmorillas: Página creada con '{{MiTitulo|Ficheros con PHP}}  {{Objetivo| ; Funciones del sistema de ficheros : http://es1.php.net/manual/es/book.filesystem.php  |Title=Documentación}}  == Lectura de un arch…'</title>
		<link rel="alternate" type="text/html" href="https://es.wikieducator.org/index.php?title=Usuario:Lmorillas/desarrollo_web_servidor/php/ficheros&amp;diff=14268&amp;oldid=prev"/>
				<updated>2014-01-21T09:16:46Z</updated>
		
		<summary type="html">&lt;p&gt;Página creada con &amp;#039;{{MiTitulo|Ficheros con PHP}}  {{Objetivo| ; Funciones del sistema de ficheros : http://es1.php.net/manual/es/book.filesystem.php  |Title=Documentación}}  == Lectura de un arch…&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Página nueva&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{MiTitulo|Ficheros con PHP}}&lt;br /&gt;
&lt;br /&gt;
{{Objetivo|&lt;br /&gt;
; Funciones del sistema de ficheros&lt;br /&gt;
: http://es1.php.net/manual/es/book.filesystem.php&lt;br /&gt;
&lt;br /&gt;
|Title=Documentación}}&lt;br /&gt;
&lt;br /&gt;
== Lectura de un archivo ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
// poner el contenido de un fichero en una cadena&lt;br /&gt;
$nombre_fichero = &amp;quot;/usr/local/algo.txt&amp;quot;;&lt;br /&gt;
$gestor = fopen($nombre_fichero, &amp;quot;r&amp;quot;);&lt;br /&gt;
$contenido = fread($gestor, filesize($nombre_fichero));&lt;br /&gt;
fclose($gestor);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Escritura en archivo ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
$fp = fopen('data.txt', 'w');&lt;br /&gt;
fwrite($fp, '1');&lt;br /&gt;
fwrite($fp, '23');&lt;br /&gt;
fclose($fp);&lt;br /&gt;
&lt;br /&gt;
// ¡el contenido de 'data.txt' ahora es 123 y no 23!&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Archivos csv ==&lt;br /&gt;
* http://es1.php.net/manual/es/function.fgetcsv.php&lt;br /&gt;
* http://es1.php.net/manual/es/function.fputcsv.php&lt;br /&gt;
&lt;br /&gt;
=== Lectura ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
$fila = 1;&lt;br /&gt;
if (($gestor = fopen(&amp;quot;test.csv&amp;quot;, &amp;quot;r&amp;quot;)) !== FALSE) {&lt;br /&gt;
    while (($datos = fgetcsv($gestor, 1000, &amp;quot;,&amp;quot;)) !== FALSE) {&lt;br /&gt;
        $numero = count($datos);&lt;br /&gt;
        echo &amp;quot;&amp;lt;p&amp;gt; $numero de campos en la línea $fila: &amp;lt;br /&amp;gt;&amp;lt;/p&amp;gt;\n&amp;quot;;&lt;br /&gt;
        $fila++;&lt;br /&gt;
        for ($c=0; $c &amp;lt; $numero; $c++) {&lt;br /&gt;
            echo $datos[$c] . &amp;quot;&amp;lt;br /&amp;gt;\n&amp;quot;;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    fclose($gestor);&lt;br /&gt;
}&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Escritura ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
$lista = array (&lt;br /&gt;
    array('aaa', 'bbb', 'ccc', 'dddd'),&lt;br /&gt;
    array('123', '456', '789'),&lt;br /&gt;
    array('&amp;quot;aaa&amp;quot;', '&amp;quot;bbb&amp;quot;')&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
$fp = fopen('archivo.csv', 'w');&lt;br /&gt;
&lt;br /&gt;
foreach ($lista as $campos) {&lt;br /&gt;
    fputcsv($fp, $campos);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
fclose($fp);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Devuelve archivo csv ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
header('Content-Type: application/excel');&lt;br /&gt;
header('Content-Disposition: attachment; filename=&amp;quot;sample.csv&amp;quot;');&lt;br /&gt;
$data = array(&lt;br /&gt;
        'aaa,bbb,ccc,dddd',&lt;br /&gt;
        '123,456,789',&lt;br /&gt;
        '&amp;quot;aaa&amp;quot;,&amp;quot;bbb&amp;quot;'&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
$fp = fopen('php://output', 'w');&lt;br /&gt;
foreach ( $data as $line ) {&lt;br /&gt;
    $val = explode(&amp;quot;,&amp;quot;, $line);&lt;br /&gt;
    fputcsv($fp, $val);&lt;br /&gt;
}&lt;br /&gt;
fclose($fp);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lmorillas</name></author>	</entry>

	</feed>