# \[PHP\] fonction include et require\_once

**URL:** <https://www.debian-fr.org/t/php-fonction-include-et-require-once/20725>\
**Category:** Programmation\
**Created:** [Février 20, 2016, 8:18 UTC](https://www.debian-fr.org/t/php-fonction-include-et-require-once/20725 "2016-02-20T20:18:05Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![yanlolot](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/y/f14d63/32.png) [@yanlolot](https://www.debian-fr.org/u/yanlolot)\
**Post date:** [Février 20, 2016, 8:18 UTC](https://www.debian-fr.org/t/php-fonction-include-et-require-once/20725/1 "2016-02-20T20:18:05Z")

</div>

Bonjour à tous

En php, les fonctions include et require\_once mettent à leur place la page appelée. ça fonctionne chez moi, et pourtant, j’ai tout de même un message d’erreur.  
Je vous file d’abord mes pages php ( remplir.php qui “include” spaw.inc.php, laquelle “require\_once” config.php) puis le message d’erreur:

[quote=“remplir.php”]\<?php  
$nom = “yann”;  
include("…/spaw2/spaw.inc.php");  
(…)[/quote]

[quote=“spaw.inc.php”]\<?php  
(…)  
echo $nom; —\> un test pour voir si ma variable nom est bien “reconnue”, et c’est la ligne 11  
require\_once(str\_replace(’\\’,’/’,dirname( **FILE** )).’/config/config.php’);  
(…)  
?\>  
[/quote]

[quote=“config.php”]\<?php  
echo $nom;—\> un test pour voir si ma variable nom est bien “reconnue”: c’est la ligne 2  
(…)  
‘dir’ =\> SpawConfig::getStaticConfigValue(‘SPAW\_DIR’).‘uploads/’.$nom.’/’, —\> c’est la ligne 251  
(…)  
?\>[/quote]

En fait, tout marche: ma variable fait bien son boulot (elle est reconnue, yann est bien écrit deux fois, et tout ce qui la concerne dans le reset du script se passe comme voulu), mais j’ai ce message qui s’affiche:

[quote=“erreur renvoyée”]Notice: Undefined variable: nom in /public\_html/spaw2/spaw.inc.php on line 11

Notice: Undefined variable: nom in /public\_html/spaw2/config/config.php on line 2

Notice: Undefined variable: nom in /public\_html/spaw2/config/config.php on line 251[/quote]

Pourquoi ?  
Et comme tout fonctionne, comment faire disparaître se message ?  
Merci d’avance pour votre aide. 😃

---

<div class="post-metadata">

**Author:** ![alexmath](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/a/8edcca/32.png) [@alexmath](https://www.debian-fr.org/u/alexmath)\
**Post date:** [Février 20, 2016, 8:18 UTC](https://www.debian-fr.org/t/php-fonction-include-et-require-once/20725/2 "2016-02-20T20:18:06Z")

</div>

tu peux désactiver l’affichage des notices dans le fichier /etc/php5/apache2/php.ini. Tu remplaces `error_reporting = E_ALL & ~E_NOTICE` par `error_reporting = E_ALL & ^E_NOTICE`

---

<div class="post-metadata">

**Author:** ![yanlolot](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/y/f14d63/32.png) [@yanlolot](https://www.debian-fr.org/u/yanlolot)\
**Post date:** [Février 20, 2016, 8:18 UTC](https://www.debian-fr.org/t/php-fonction-include-et-require-once/20725/3 "2016-02-20T20:18:08Z")

</div>

Merci pour l’astuce, mais ce script est effectué sur un serveur sur lequel je n’ai absolument pas accés à /etc/php5/apache2/php.ini.

---

<div class="post-metadata">

**Author:** ![Tycho\_Brahe](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/t/ec9cab/32.png) [@Tycho\_Brahe](https://www.debian-fr.org/u/Tycho_Brahe)\
**Post date:** [Février 20, 2016, 8:18 UTC](https://www.debian-fr.org/t/php-fonction-include-et-require-once/20725/4 "2016-02-20T20:18:08Z")

</div>

Salut,

[quote=“yanlolot”]Merci pour l’astuce, mais ce script est effectué sur un serveur sur lequel je n’ai absolument pas accés à /etc/php5/apache2/php.ini.[/quote]C’est pour ce genre de cas qu’il existe la fonction [error\_reporting()](http://fr3.php.net/manual/fr/function.error-reporting.php) qui évite de modifier le php.ini 😉

---

<div class="post-metadata">

**Author:** ![thomas.leclerc](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/t/59ef9b/32.png) [@thomas.leclerc](https://www.debian-fr.org/u/thomas.leclerc)\
**Post date:** [Février 20, 2016, 8:18 UTC](https://www.debian-fr.org/t/php-fonction-include-et-require-once/20725/5 "2016-02-20T20:18:08Z")

</div>

[http://fr3.php.net/manual/fr/function.include.php](http://fr3.php.net/manual/fr/function.include.php)

```auto
<?php
@include('./file.php');
?>
```

ou

```auto
<?php
//turn off warnings
error_reporting(E_ALL & ~E_WARNING);
include('./file.php');
// Turn on warnings
error_reporting(E_ALL);
?>
```

::grillé ![:smt006](https://www.debian-fr.org/uploads/default/original/1X/924eb3db8bedad6a0d333b02031d3c6a9af9d9c5.gif)

---

<div class="post-metadata">

**Author:** ![yanlolot](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/y/f14d63/32.png) [@yanlolot](https://www.debian-fr.org/u/yanlolot)\
**Post date:** [Février 20, 2016, 8:18 UTC](https://www.debian-fr.org/t/php-fonction-include-et-require-once/20725/6 "2016-02-20T20:18:08Z")

</div>

j’ai opté pour error\_reporting(E\_ALL & ~E\_WARNING);et error\_reporting(E\_ALL & ~E\_NOTICE);.C’est parfait. 😃  
N’empêche que je ne m’explique pas ces erreurs…

Merci ❗

---

<div class="post-metadata">

**Author:** ![Ashgenesis](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/a/57b2e6/32.png) [@Ashgenesis](https://www.debian-fr.org/u/Ashgenesis)\
**Post date:** [Février 20, 2016, 8:18 UTC](https://www.debian-fr.org/t/php-fonction-include-et-require-once/20725/7 "2016-02-20T20:18:12Z")

</div>

Alors il est fortement déconseillé de mettre l’@ et de désactiver les notices. Cependant en prod on logguera les erreurs plutôt que de les afficher.

Ici ton problème est une initialisation de ta variable qui n’est pas faite au moment où on l’appel avec le peu que tu nous donne on ne peux pas faire grand chose pour savoir pourquoi cette notice apparaît.

Mais je te conseille plutôt que de cacher cette erreur de corriger ton code.

---

<div class="post-metadata">

**Author:** ![yanlolot](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/y/f14d63/32.png) [@yanlolot](https://www.debian-fr.org/u/yanlolot)\
**Post date:** [Février 20, 2016, 8:18 UTC](https://www.debian-fr.org/t/php-fonction-include-et-require-once/20725/8 "2016-02-20T20:18:21Z")

</div>

> [@](#):
>
> Ici ton problème est une initialisation de ta variable qui n’est pas faite au moment où on l’appel avec le peu que tu nous donne on ne peux pas faire grand chose pour savoir pourquoi cette notice apparaît.

Merci de ton aide, et voilà l’intégralité des fichiers, puis les messages d’erreurs:

[quote=“remplir1.php”]\<?php  
$login = $\_GET[‘login’];  
include("…/spaw2/spaw.inc.php");  
$spaw1 = new SpawEditor(“spaw1”, “”);  
$spaw1-\>setConfigItem(  
‘PG\_SPAWFM\_SETTINGS’,  
array(  
‘allow\_upload’ =\> true,  
‘allow\_modify’ =\> true,  
‘allow\_create\_subdirectories’ =\> true,  
‘allow\_modify\_subdirectories’ =\> true,  
‘recursive’ =\> true,  
‘max\_upload\_filesize’ =\> 0,  
‘allowed\_filetypes’ =\> array(‘any’),  
),  
SPAW\_CFG\_TRANSFER\_SECURE  
);  
?\>

 remplir Nouvelle entrée pour \<?php echo [color=#BF0000]$login[/color]; ?\>  
**Date :**   
\<?php $spaw1-\>show(); ?\>   
 [/quote] Remarque: l'affichage de $login ne pose pas de pb dans cette page ([i]Nouvelle entrée pour \<?php echo $\_GET['login']; ?\> [/i]) [quote="spaw.inc.php"]\<?php /\*\* \* SPAW Editor v.2 Main include file \* \* Include this file in your script \* \* @package spaw2 \* @author Alan Mendelevich \* @copyright UAB Solmetra \*/ [color=#4000FF]require\_once(str\_replace('\\\\','/',dirname(\_\_FILE\_\_)).'/config/config.php');[/color] require\_once(str\_replace('\\\\','/',dirname(\_\_FILE\_\_)).'/class/editor.class.php');

// load plugin configs  
$spaw\_pgdir = SpawConfig::getStaticConfigValue(‘SPAW\_ROOT’).‘plugins/’;  
if (is\_dir($spaw\_pgdir))  
{  
if ($spaw\_dh = opendir($spaw\_pgdir))  
{  
while (($spaw\_pg = readdir($spaw\_dh)) != false)  
{  
if ($spaw\_pg != ‘.’ && $spaw\_pg != ‘…’)  
{  
if (is\_dir($spaw\_pgdir.$spaw\_pg.’/config’))  
{  
if ($spaw\_pgdh = opendir($spaw\_pgdir.$spaw\_pg.’/config’))  
{  
while (($spaw\_fn = readdir($spaw\_pgdh)) !== false)  
{  
if ($spaw\_fn != ‘.’ && $spaw\_fn != ‘…’ && !is\_dir($spaw\_pgdir.$spaw\_pg.’/config/’.$spaw\_fn))  
include($spaw\_pgdir.$spaw\_pg.’/config/’.$spaw\_fn);  
}  
closedir($spaw\_pgdh);  
}  
}  
}  
}  
closedir($spaw\_dh);  
}  
}  
?\>  
[/quote]

[quote=“config.php”]\<?php  
//error\_reporting(E\_ALL & ~E\_NOTICE);  
require\_once(str\_replace(’\\’,’/’,dirname( **FILE** )).’/…/class/config.class.php’);  
require\_once(str\_replace(’\\’,’/’,dirname( **FILE** )).’/…/class/util.class.php’);

// sets physical filesystem directory of web site root  
// if calculation fails (usually if web server is not apache) set this manually  
SpawConfig::setStaticConfigItem(‘DOCUMENT\_ROOT’, str\_replace("\","/",SpawVars::getServerVar(“DOCUMENT\_ROOT”)));  
if (!ereg(’/$’, SpawConfig::getStaticConfigValue(‘DOCUMENT\_ROOT’)))  
SpawConfig::setStaticConfigItem(‘DOCUMENT\_ROOT’, SpawConfig::getStaticConfigValue(‘DOCUMENT\_ROOT’).’/’);  
// sets physical filesystem directory where spaw files reside  
// should work fine most of the time but if it fails set SPAW\_ROOT manually by providing correct path  
SpawConfig::setStaticConfigItem(‘SPAW\_ROOT’, str\_replace("\","/",realpath(dirname( **FILE** )."/…").’/’));  
// sets virtual path to the spaw directory on the server  
// if calculation fails set this manually  
SpawConfig::setStaticConfigItem(‘SPAW\_DIR’, ‘’.str\_replace(SpawConfig::getStaticConfigValue(“DOCUMENT\_ROOT”),’’,SpawConfig::getStaticConfigValue(“SPAW\_ROOT”)));

/\*  
// semi-automatic path calculation  
// comment the above settings of DOCUMENT\_ROOT, SPAW\_ROOT and SPAW\_DIR  
// and use this block if the above fails.  
// set SPAW\_DIR manually. If you access demo page by [domain.com/spaw2/demo/demo.php](http://domain.com/spaw2/demo/demo.php)  
// then set SPAW\_DIR to /spaw2/  
SpawConfig::setStaticConfigItem(‘SPAW\_DIR’, ‘/spaw2/’);  
// and the following settings will be calculated automaticly  
SpawConfig::setStaticConfigItem(‘SPAW\_ROOT’, str\_replace("\","/",realpath(dirname( **FILE** )."/…").’/’));  
SpawConfig::setStaticConfigItem(‘DOCUMENT\_ROOT’, substr(SpawConfig::getStaticConfigValue(‘SPAW\_ROOT’),0,strlen(SpawConfig::getStaticConfigValue(‘SPAW\_ROOT’))-strlen(SpawConfig::getStaticConfigValue(‘SPAW\_DIR’))));  
\*/

/\*  
// under IIS you will probably need to setup the above paths manually. it would be something like this  
SpawConfig::setStaticConfigItem(‘DOCUMENT\_ROOT’, ‘c:/inetpub/wwwroot/’);  
SpawConfig::setStaticConfigItem(‘SPAW\_ROOT’, ‘c:/inetpub/wwwroot/spaw2/’);  
SpawConfig::setStaticConfigItem(‘SPAW\_DIR’, ‘/spaw2/’);  
\*/

// DEFAULTS used when no value is set from code  
// language  
SpawConfig::setStaticConfigItem(‘default\_lang’,‘en’);  
// output charset (empty strings means charset specified in language file)  
SpawConfig::setStaticConfigItem(‘default\_output\_charset’,’’);  
// theme  
SpawConfig::setStaticConfigItem(‘default\_theme’,‘spaw2’);  
// toolbarset  
SpawConfig::setStaticConfigItem(‘default\_toolbarset’,‘standard’);  
// stylesheet  
SpawConfig::setStaticConfigItem(‘default\_stylesheet’,SpawConfig::getStaticConfigValue(‘SPAW\_DIR’).‘wysiwyg.css’);  
// width  
SpawConfig::setStaticConfigItem(‘default\_width’,‘100%’);  
// height  
SpawConfig::setStaticConfigItem(‘default\_height’,‘200px’);

// specifies if language subsystem should use iconv functions to convert strings to the specified charset  
SpawConfig::setStaticConfigItem(‘USE\_ICONV’,true);  
// specifies rendering mode to use: “xhtml” - renders using spaw’s engine, “builtin” - renders using browsers engine  
SpawConfig::setStaticConfigItem(‘rendering\_mode’, ‘xhtml’, SPAW\_CFG\_TRANSFER\_JS);  
// specifies that xhtml rendering engine should indent it’s output  
SpawConfig::setStaticConfigItem(‘beautify\_xhtml\_output’, true, SPAW\_CFG\_TRANSFER\_JS);  
// specifies host and protocol part (like [mydomain.com](http://mydomain.com)) that should be added to urls returned from file manager (and probably other places in the future)  
SpawConfig::setStaticConfigItem(‘base\_href’, ‘’, SPAW\_CFG\_TRANSFER\_JS);  
// specifies if spaw should strip domain part from absolute urls (IE makes all links absolute)  
SpawConfig::setStaticConfigItem(‘strip\_absolute\_urls’, true, SPAW\_CFG\_TRANSFER\_JS);  
// specifies in which directions resizing is allowed (values: none, horizontal, vertical, both)  
SpawConfig::setStaticConfigItem(‘resizing\_directions’, ‘vertical’, SPAW\_CFG\_TRANSFER\_JS);  
// specifies that special characters should be converted to the respective html entities  
SpawConfig::setStaticConfigItem(‘convert\_html\_entities’, false, SPAW\_CFG\_TRANSFER\_JS);

// data for style (css class) dropdown list  
SpawConfig::setStaticConfigItem(“dropdown\_data\_core\_style”,  
array(  
’’ =\> ‘Normal’,  
‘style1’ =\> ‘Style No.1’,  
‘style2’ =\> ‘Style No.2’,  
)  
);  
// data for style (css class) dropdown in table properties dialog  
SpawConfig::setStaticConfigItem(“table\_styles”,  
array(  
’’ =\> ‘Normal’,  
‘style1’ =\> ‘Style No.1’,  
‘style2’ =\> ‘Style No.2’,  
)  
);  
// data for style (css class) dropdown in table cell properties dialog  
SpawConfig::setStaticConfigItem(“table\_cell\_styles”,  
array(  
’’ =\> ‘Normal’,  
‘style1’ =\> ‘Style No.1’,  
‘style2’ =\> ‘Style No.2’,  
)  
);  
// data for style (css class) dropdown in image properties dialog  
SpawConfig::setStaticConfigItem(“image\_styles”,  
array(  
’’ =\> ‘Normal’,  
‘style1’ =\> ‘Style No.1’,  
‘style2’ =\> ‘Style No.2’,  
)  
);  
// data for fonts dropdown list  
SpawConfig::setStaticConfigItem(“dropdown\_data\_core\_fontname”,  
array(  
’’ =\> ‘Default’,  
‘Arial’ =\> ‘Arial’,  
‘Courier’ =\> ‘Courier’,  
‘Tahoma’ =\> ‘Tahoma’,  
‘Times New Roman’ =\> ‘Times’,  
‘Verdana’ =\> ‘Verdana’  
)  
);  
// data for fontsize dropdown list  
SpawConfig::setStaticConfigItem(“dropdown\_data\_core\_fontsize”,  
array(  
’’ =\> ‘Default’,  
‘1’ =\> ‘1’,  
‘2’ =\> ‘2’,  
‘3’ =\> ‘3’,  
‘4’ =\> ‘4’,  
‘5’ =\> ‘5’,  
‘6’ =\> ‘6’  
)  
);  
// data for paragraph dropdown list  
SpawConfig::setStaticConfigItem(“dropdown\_data\_core\_formatBlock”,  
array(  
’

’ =\> ‘Normal’,  
’

# ’ =\> ‘Heading 1’, ’

## ’ =\> ‘Heading 2’, ’

### ’ =\> ‘Heading 3’, ’

#### ’ =\> ‘Heading 4’, ’

##### ’ =\> ‘Heading 5’, ’

###### ’ =\> ‘Heading 6’, ’ ``` ’ => ‘Preformatted’, ’’ => ‘Address’ ) ); // data for link targets drodown list in hyperlink dialog SpawConfig::setStaticConfigItem(“a_targets”, array( ’_self’ => ‘Self’, ’_blank’ => ‘Blank’, ’_top’ => ‘Top’, ’_parent’ => ‘Parent’ ) ); // data for quick links dropdown (new in 2.0.6) SpawConfig::setStaticConfigItem(“quick_links”, array( ‘[http://spaweditor.com/](http://spaweditor.com/)’ => ‘SPAW Editor’, ‘[http://forums.solmetra.com/](http://forums.solmetra.com/)’ => ‘SPAW Support Forums’, ‘[http://blog.solmetra.com/](http://blog.solmetra.com/)’ => ‘Solmetra’s Developer Blog’ ), SPAW_CFG_TRANSFER_SECURE ); // toolbar sets (should start with “toolbarset\_” // standard core toolbars SpawConfig::setStaticConfigItem(‘toolbarset\_standard’, array( “format” =\> “format”, “style” =\> “style”, “edit” =\> “edit”, “table” =\> “table”, “plugins” =\> “plugins”, “insert” =\> “insert”, “tools” =\> “tools” ) ); // all core toolbars SpawConfig::setStaticConfigItem(‘toolbarset\_all’, array( “format” =\> “format”, “style” =\> “style”, “edit” =\> “edit”, “table” =\> “table”, “plugins” =\> “plugins”, “insert” =\> “insert”, “tools” =\> “tools”, “font” =\> “font” ) ); // mini core toolbars SpawConfig::setStaticConfigItem(‘toolbarset\_mini’, array( “format” =\> “format\_mini”, “edit” =\> “edit”, “tools” =\> “tools” ) ); // colorpicker config SpawConfig::setStaticConfigItem(‘colorpicker\_predefined\_colors’, array( ‘black’, ‘silver’, ‘gray’, ‘white’, ‘maroon’, ‘red’, ‘purple’, ‘fuchsia’, ‘green’, ‘lime’, ‘olive’, ‘yellow’, ‘navy’, ‘blue’, ’#fedcba’, ‘aqua’ ), SPAW\_CFG\_TRANSFER\_SECURE ); // SpawFm plugin config: // global filemanager settings SpawConfig::setStaticConfigItem( ‘PG\_SPAWFM\_SETTINGS’, array( ‘allowed\_filetypes’ =\> array(‘any’), // allowed filetypes groups/extensions ’allow\_modify’ =\> false, // allow edit filenames/delete files in directory ’allow\_upload’ =\> false, // allow uploading new files in directory //‘chmod\_to’ =\> 0777, // change the permissions of an uploaded file if allowed // (see PHP chmod() function description for details), or comment out to leave default ’max\_upload\_filesize’ =\> 0, // max upload file size allowed in bytes, or 0 to ignore ’max\_img\_width’ =\> 0, // max uploaded image width allowed, or 0 to ignore ’max\_img\_height’ =\> 0, // max uploaded image height allowed, or 0 to ignore ’recursive’ =\> false, // allow using subdirectories ’allow\_modify\_subdirectories’ =\> false, // allow renaming/deleting subdirectories ’allow\_create\_subdirectories’ =\> false, // allow creating subdirectories ’forbid\_extensions’ =\> array(‘php’), // disallow uploading files with specified extensions ’forbid\_extensions\_strict’ =\> true, // disallow specified extensions in the middle of the filename ), SPAW\_CFG\_TRANSFER\_SECURE ); // directories SpawConfig::setStaticConfigItem( ‘PG\_SPAWFM\_DIRECTORIES’, array( array( ‘dir’ =\> SpawConfig::getStaticConfigValue(‘SPAW\_DIR’).“uploads/$login/” , \<–la ligne 243 : c’est là que ça bug //‘fsdir’ =\> SpawConfig::getStaticConfigValue(‘SPAW\_ROOT’).‘uploads/yann/’, // optional absolute physical filesystem path ’caption’ =\> ‘sujets’, ‘params’ =\> array(‘default\_dir’ =\> true, ‘allowed\_filetypes’ =\> array(‘any’) ) ), ), SPAW\_CFG\_TRANSFER\_SECURE ); ?\>[/quote] Et l’erreur: ```auto ``` la ligne 243 est en rouge dans config.php. En espèrant que ça puisse vous aider à m’aider 😃 ```

---

<div class="post-metadata">

**Author:** ![Ashgenesis](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/a/57b2e6/32.png) [@Ashgenesis](https://www.debian-fr.org/u/Ashgenesis)\
**Post date:** [Février 20, 2016, 8:18 UTC](https://www.debian-fr.org/t/php-fonction-include-et-require-once/20725/9 "2016-02-20T20:18:23Z")

</div>

Dans remplir1.php tu initialise ta variable login avec cette commande

```auto

```

1 -\> les données provenant de $\_GET ne sont pas du tout sur il faut vérifier que ce qu’on te donne corresponde bien à ce que tu veux.

2 -\> si il ne t’ai rien passé dans l’url alors $login ne vaut rien et ça va planter après donc si $\_GET[‘login’] est vide tu lui affecte un valeur par défaut afin que ta variable soit toujours initialisée.

---

<div class="post-metadata">

**Author:** ![yanlolot](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/y/f14d63/32.png) [@yanlolot](https://www.debian-fr.org/u/yanlolot)\
**Post date:** [Février 20, 2016, 8:18 UTC](https://www.debian-fr.org/t/php-fonction-include-et-require-once/20725/10 "2016-02-20T20:18:25Z")

</div>

@1 :Mais dans remplir1.php, il y la ligne `<center> Nouvelle entrée pour <?php echo $login; ?></center><br>` qui affiche correctement la valeur de $login (et la valeur voulue de $login: celle provenant de $\_GET).  
Et même enfaisant le test de mettre $login = yann; dans remplir1.php, j’ai tjs la même erreur.  
@2: Même en faisant au prealable un test avec isset: if( ! isset( $login ) ) $login = yann; , et en initialisant la variable, tjs la même erreur.

Et comme je le fasait remarque dans mon premier post, si je rajoute un echo $login; au début de config.php, il écrit bien la valeur voulue de $login, mais m’envoie pourtant ce message d’erreur.

---

<div class="post-metadata">

**Author:** ![Hoshin](https://www.debian-fr.org/user_avatar/www.debian-fr.org/hoshin/32/3672_2.png) [@Hoshin](https://www.debian-fr.org/u/Hoshin)\
**Post date:** [Février 20, 2016, 8:18 UTC](https://www.debian-fr.org/t/php-fonction-include-et-require-once/20725/11 "2016-02-20T20:18:46Z")

</div>

Ca ne pourrait pas être un pb de visibilité de ta variable ça ? as-tu essayé de préfixer “nom” dans ton fichier inclus par “global” ? cela fonctionne-t-il mieux ? ce n’est pas forcément la méthode à adopter mais cela pourrait peut être donner un indice à d’autres.

---

<div class="post-metadata">

**Author:** ![yanlolot](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/y/f14d63/32.png) [@yanlolot](https://www.debian-fr.org/u/yanlolot)\
**Post date:** [Février 20, 2016, 8:18 UTC](https://www.debian-fr.org/t/php-fonction-include-et-require-once/20725/12 "2016-02-20T20:18:49Z")

</div>

En fait, c’était pour configurer le file manager de spaw (éditeur html en ligne). J’essayais de passer en paramètre le dossier de chaque utilisateur au fichier config.php de spaw, alors qu’il existe une méthode pour personnaliser le FM , donnée dans la doc (et qui marche très bien).  
Donc, pb résolu. (Mais je me demande si le pb que je rencontrais dans ce fil n’était pas lié à celui de l’autre fil)
