mirror of
https://github.com/php/doc-fr.git
synced 2026-03-24 07:02:06 +01:00
150 lines
4.9 KiB
XML
150 lines
4.9 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 3f1dbc451b313fb1ec8058f24c1beccf55fce316 Maintainer: yannick Status: ready -->
|
|
<!-- Reviewed: yes -->
|
|
|
|
<chapter xml:id="mbstring.overload" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<title>
|
|
Exploitation des chaînes multioctets en PHP
|
|
</title>
|
|
|
|
&warn.deprecated.feature-7-2-0.removed-8-0-0;
|
|
<para>
|
|
Il est possible que l'on trouve difficile de faire fonctionner une application PHP
|
|
existante dans un environnement multioctets. Ceci est dû au fait
|
|
que la plupart des applications PHP sont écrites avec des fonctions
|
|
de chaînes de caractères standards comme la fonction
|
|
<function>substr</function>, qui est connue pour ne pas gérer
|
|
proprement les chaînes multioctets.
|
|
</para>
|
|
<para>
|
|
Mbstring supporte aussi la surcharge de fonctions, pour
|
|
permettre le support des chaînes multioctets sans modifier les
|
|
scripts PHP. En utilisant ce système de surcharge de fonctions,
|
|
certaines fonctions PHP seront remplacées par leur équivalent
|
|
de mbstring. Par exemple <function>mb_substr</function> remplacera
|
|
<function>substr</function>. Ce système de remplacement transparent,
|
|
permet un portage simple et efficace des applications.
|
|
</para>
|
|
<para>
|
|
Pour utiliser la surcharge de fonctions, définissez
|
|
<literal>mbstring.func_overload</literal>, dans le &php.ini;,
|
|
à une valeur positive qui représente une combinaison de masques d'octets
|
|
spécifiant les catégories de fonctions à surcharger. Il doit être défini à
|
|
1 pour surcharger la fonction <function>mail</function>, 2 pour les
|
|
fonctions de chaînes, 4 pour les fonctions d'expression régulières.
|
|
Par exemple, avec la valeur 7, toutes les fonctions précédentes seront
|
|
surchargées. Voici la liste complète des fonctions surchargées, avec
|
|
leur fonction de remplacement.
|
|
<table>
|
|
<title>Fonctions de remplacement</title>
|
|
<tgroup cols="3">
|
|
<thead>
|
|
<row>
|
|
<entry>Valeur de mbstring.func_overload</entry>
|
|
<entry>Fonction originale</entry>
|
|
<entry>Fonction de remplacement</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>1</entry>
|
|
<entry><function>mail</function></entry>
|
|
<entry><function>mb_send_mail</function></entry>
|
|
</row>
|
|
<row>
|
|
<entry>2</entry>
|
|
<entry><function>strlen</function></entry>
|
|
<entry><function>mb_strlen</function></entry>
|
|
</row>
|
|
<row>
|
|
<entry>2</entry>
|
|
<entry><function>strpos</function></entry>
|
|
<entry><function>mb_strpos</function></entry>
|
|
</row>
|
|
<row>
|
|
<entry>2</entry>
|
|
<entry><function>strrpos</function></entry>
|
|
<entry><function>mb_strrpos</function></entry>
|
|
</row>
|
|
<row>
|
|
<entry>2</entry>
|
|
<entry><function>substr</function></entry>
|
|
<entry><function>mb_substr</function></entry>
|
|
</row>
|
|
<row>
|
|
<entry>2</entry>
|
|
<entry><function>strtolower</function></entry>
|
|
<entry><function>mb_strtolower</function></entry>
|
|
</row>
|
|
<row>
|
|
<entry>2</entry>
|
|
<entry><function>strtoupper</function></entry>
|
|
<entry><function>mb_strtoupper</function></entry>
|
|
</row>
|
|
<row>
|
|
<entry>2</entry>
|
|
<entry><function>stripos</function></entry>
|
|
<entry><function>mb_stripos</function></entry>
|
|
</row>
|
|
<row>
|
|
<entry>2</entry>
|
|
<entry><function>strripos</function></entry>
|
|
<entry><function>mb_strripos</function></entry>
|
|
</row>
|
|
<row>
|
|
<entry>2</entry>
|
|
<entry><function>strstr</function></entry>
|
|
<entry><function>mb_strstr</function></entry>
|
|
</row>
|
|
<row>
|
|
<entry>2</entry>
|
|
<entry><function>stristr</function></entry>
|
|
<entry><function>mb_stristr</function></entry>
|
|
</row>
|
|
<row>
|
|
<entry>2</entry>
|
|
<entry><function>strrchr</function></entry>
|
|
<entry><function>mb_strrchr</function></entry>
|
|
</row>
|
|
<row>
|
|
<entry>2</entry>
|
|
<entry><function>substr_count</function></entry>
|
|
<entry><function>mb_substr_count</function></entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</table>
|
|
</para>
|
|
<note>
|
|
<para>
|
|
Il n'est pas recommandé d'utiliser le remplacement des fonctions mbstring
|
|
dans un contexte de <literal>per-directory</literal>, car il n'est pas
|
|
confirmé encore qu'elles sont suffisamment stables dans un environnement
|
|
de production et peuvent conduire à des résultats incohérents.
|
|
</para>
|
|
</note>
|
|
</chapter>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|
|
|