Discussion: Re: include
Afficher un message
Vieux 24/07/2007, 22h13   #1
Rik
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: include

On Tue, 24 Jul 2007 23:04:46 +0200, Jean Pierre Daviau <Once@WasEno.ugh>
wrote:
> global $autoexec;
> $autoexec = "C:\backJP\autoexec.bat";


> --- snip ----
>
> require_once('paths.inc');
> function updateFichier(){
> if (!$myBool = fopen ($autoexec, "a")) {
> echo "Cant create($autoexec)";
> exit;
> }
>
> The include file is printed on screen
> The function exit with Cant create the file
>
> If I write
> function updateFichier(){
> global $autoexec;
> $autoexec = "autoexec.bat";


This last line is not neccesary

> ......
> it works . . .


You obviously missed something in scopes. I suggest you read up on it:
<http://www.php.net/global>

This very example is explained over there.
--
Rik Wasmus
  Réponse avec citation
 
Page generated in 0,04474 seconds with 9 queries