<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.filesystem.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'it',
  ),
  'this' => 
  array (
    0 => 'function.file-get-contents.php',
    1 => 'file_get_contents',
    2 => 'Legge un file all\'interno di una stringa',
  ),
  'up' => 
  array (
    0 => 'ref.filesystem.php',
    1 => 'Filesystem Funzioni',
  ),
  'prev' => 
  array (
    0 => 'function.file-exists.php',
    1 => 'file_exists',
  ),
  'next' => 
  array (
    0 => 'function.file-put-contents.php',
    1 => 'file_put_contents',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'it',
    'path' => 'reference/filesystem/functions/file-get-contents.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.file-get-contents" class="refentry">
   <div class="refnamediv">
    <h1 class="refname">file_get_contents</h1> 
    <p class="verinfo">(PHP 4 &gt;= 4.3.0, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">file_get_contents</span> &mdash; <span class="dc-title">Legge un file all&#039;interno di una stringa</span></p>

   </div>
   <div class="refsect1 unknown-568" id="refsect1-function.file-get-contents-unknown-568">
    <h3 class="title">Description</h3>
     <div class="methodsynopsis dc-description">
      <span class="methodname"><strong>file_get_contents</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$filename</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> <code class="parameter">$use_include_path</code><span class="initializer"> = ?</span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> <code class="parameter">$context</code><span class="initializer"> = ?</span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$offset</code><span class="initializer"> = ?</span></span><br>): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>

    <p class="para rdfs-comment"> 
     Simile alla funzione <span class="function"><a href="function.file.php" class="function">file()</a></span>, tranne che
     <span class="function"><strong>file_get_contents()</strong></span> restituisce il file in una stringa,
     iniziando allo specificato <code class="parameter">offset</code>.
     Se si verifica un errore <span class="function"><strong>file_get_contents()</strong></span> restituirà <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>
    </p>
    <blockquote class="note"><p><strong class="note">Nota</strong>: 
     <span class="simpara">
      Il parametro<code class="parameter">offset</code> è stato aggiunto nel PHP 5.1.0.
     </span>
    </p></blockquote>
    <blockquote class="note"><p><strong class="note">Nota</strong>: 
     <p class="para">
      Se si sta aprendo un URI con caratteri speciali, spazi ad esempio, 
      si ha bisogno di decodificare l&#039; URI con <span class="function"><a href="function.urlencode.php" class="function">urlencode()</a></span>.
     </p>
   </p></blockquote>   
    <blockquote class="note"><p><strong class="note">Nota</strong>: <span class="simpara">Questa funzione è
 binary-safe (gestisce correttamente i file binari)</span></p></blockquote>
    <div class="tip"><strong class="tip">Suggerimento</strong><p class="simpara">È possibile utilizzare una URL come un
nome di file con questa funzione se <a href="filesystem.configuration.php#ini.allow-url-fopen" class="link">fopen wrappers</a> è stata abilitata.
Vedere <span class="function"><a href="function.fopen.php" class="function">fopen()</a></span> per maggiori informazioni su come specificare 
i nomi di file. Vedere <a href="wrappers.php" class="xref">Supported Protocols and Wrappers</a> per i link verso le informazioni
sulle capacità dei vari wrapper, note sul loro uso,
informazioni sulle variabili predefinite che
forniscono.</p></div>
    <blockquote class="note"><p><strong class="note">Nota</strong>: <span class="simpara">Il supporto per il contesto è stato
aggiunto in PHP 5.0.0. Per la descrizione del <code class="literal">contesto</code>, fare riferimento a
<a href="ref.stream.php" class="xref">Stream Funzioni</a>.</span></p></blockquote>
    <div class="warning"><strong class="warning">Avviso</strong><p class="para">Quando si usa SSL, Microsoft IIS
viola il protocollo chiudendo la connessione senza inviare
un&#039;indicazione <code class="literal">close_notify</code>. PHP indicherà questo con un &quot;SSL: Fatal
Protocol Error&quot; al raggiungimento della fine dei dati. Per aggirare questo problema, occorre
abbassare il livello <a href="errorfunc.configuration.php#ini.error-reporting" class="link">error_reporting</a> per non
includere questi avvisi.
PHP 4.3.7 e successivi sono in grado di identificare gli IIS bacati quando si apre
lo stream utilizzando il wrapper <code class="literal">https://</code> e disabilitano
automaticamente l&#039;avviso. Se si usa <span class="function"><a href="function.fsockopen.php" class="function">fsockopen()</a></span> per creare
un socket <code class="literal">ssl://</code>, occorre identificare e sopprimere
l&#039;avviso manualmente.</p></div>
    <p class="simpara">
     Vedere anche <span class="function"><a href="function.fgets.php" class="function">fgets()</a></span>, <span class="function"><a href="function.file.php" class="function">file()</a></span>,
     <span class="function"><a href="function.fread.php" class="function">fread()</a></span>, <span class="function"><a href="function.include.php" class="function">include</a></span>,
     <span class="function"><a href="function.readfile.php" class="function">readfile()</a></span>  e
     <span class="function"><a href="function.file-put-contents.php" class="function">file_put_contents()</a></span>.
    </p>
   </div>

  </div><?php manual_footer($setup); ?>