<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.locale.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'fr',
  ),
  'this' => 
  array (
    0 => 'locale.acceptfromhttp.php',
    1 => 'Locale::acceptFromHttp',
    2 => 'Devine la meilleure locale &agrave; partir de l\'en-t&ecirc;te HTTP &quot;Accept-Language&quot;',
  ),
  'up' => 
  array (
    0 => 'class.locale.php',
    1 => 'Locale',
  ),
  'prev' => 
  array (
    0 => 'class.locale.php',
    1 => 'Locale',
  ),
  'next' => 
  array (
    0 => 'locale.canonicalize.php',
    1 => 'Locale::canonicalize',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'fr',
    'path' => 'reference/intl/locale/accept-from-http.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="locale.acceptfromhttp" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Locale::acceptFromHttp</h1>
  <h1 class="refname">locale_accept_from_http</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.3.0, PHP 7, PHP 8, PECL intl &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">Locale::acceptFromHttp</span> -- <span class="refname">locale_accept_from_http</span> &mdash; <span class="dc-title">Devine la meilleure locale à partir de l&#039;en-tête HTTP <code class="literal">&quot;Accept-Language&quot;</code></span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-locale.acceptfromhttp-description">
  <h3 class="title">Description</h3>
  <p class="para">
   Style orienté objet
  </p>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="modifier">static</span> <span class="methodname"><strong>Locale::acceptFromHttp</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$header</code></span>): <span class="type"><span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   Style procédural
  </p>
  <div class="methodsynopsis dc-description"><span class="methodname"><strong>locale_accept_from_http</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$header</code></span>): <span class="type"><span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   Essaie de trouver une locale qui peut satisfaire la liste de langue qui est
   demandée par l&#039;en-tête HTTP <code class="literal">&quot;Accept-Language&quot;</code>.
  </p>
 </div>

 
 <div class="refsect1 parameters" id="refsect1-locale.acceptfromhttp-parameters">
  <h3 class="title">Liste de paramètres</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">header</code></dt>
     <dd>
      <p class="para">
       La chaîne contenant l&#039;en-tête <code class="literal">&quot;Accept-Language&quot;</code>,
       au format de la RFC 2616.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>

 
 
 <div class="refsect1 returnvalues" id="refsect1-locale.acceptfromhttp-returnvalues">
  <h3 class="title">Valeurs de retour</h3>
  <p class="para">
   L&#039;identifiant de locale correspondant.
  </p>
  <p class="para">
   Retourne <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> quand la longueur de <code class="parameter">header</code> dépasse
   <strong><code><a href="intl.constants.php#constant.intl-max-locale-len">INTL_MAX_LOCALE_LEN</a></code></strong>.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-locale.acceptfromhttp-examples">
  <h3 class="title">Exemples</h3>
  <div class="example" id="example-1">
   <p><strong>Exemple #1 Exemple avec <span class="function"><strong>locale_accept_from_http()</strong></span>, procédural</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$locale </span><span style="color: #007700">= </span><span style="color: #0000BB">locale_accept_from_http</span><span style="color: #007700">(</span><span style="color: #0000BB">$_SERVER</span><span style="color: #007700">[</span><span style="color: #DD0000">'HTTP_ACCEPT_LANGUAGE'</span><span style="color: #007700">]);<br />echo </span><span style="color: #0000BB">$locale</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

  </div>
  <div class="example" id="example-2">
   <p><strong>Exemple #2 Exemple avec <span class="function"><strong>locale_accept_from_http()</strong></span>, POO</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$locale </span><span style="color: #007700">= </span><span style="color: #0000BB">Locale</span><span style="color: #007700">::</span><span style="color: #0000BB">acceptFromHttp</span><span style="color: #007700">(</span><span style="color: #0000BB">$_SERVER</span><span style="color: #007700">[</span><span style="color: #DD0000">'HTTP_ACCEPT_LANGUAGE'</span><span style="color: #007700">]);<br />echo </span><span style="color: #0000BB">$locale</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

  </div>
  <p class="para">L&#039;exemple ci-dessus va afficher :</p>
  <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">en_US</pre>
</div>
  </div>
 </div>

 
 <div class="refsect1 seealso" id="refsect1-locale.acceptfromhttp-seealso">
  <h3 class="title">Voir aussi</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="locale.lookup.php" class="function" rel="rdfs-seeAlso">locale_lookup()</a> - Recherche dans la liste la meilleure langue</span></li>
   </ul>
  </p>
 </div>

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