R: [PHP] session_start() and fopen

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Christopher: this is just a simplified code, I use it to generate some
xml file, no loop is present.

Try it as it is: you will find that two files will be generated while it
should be only one.
If you remove 'session_start()' then only one file will be generated: that's
correct!

Fabri 

-----Messaggio originale-----
Da: Christopher Weldon [mailto:cweldon@xxxxxxxxxxxxxxxxxx] 
Inviato: mercoledì 13 settembre 2006 22.28
A: Fabri
Cc: php-general@xxxxxxxxxxxxx
Oggetto: Re:  session_start() and fopen

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Fabri wrote:
> Hello, would you please help me on this issue that is making me crazy?
> 
>  
> 
>  
> 
> I start a session with session_start() and I need to write a file, the
file
> is written twice! If I remove session_start the code works obviously fine.
> 
> I used  the date as name of file so I can see the problem, otherwise the
> file is overwritten.
> 
>  
> 
> session_start();
> 
> $nome = date("Ymd-His");
> 
> $path = $nome . ".xml";
> 
> $fh = fopen($path, 'w');
> 
> if ($fh) {
> 
>     fwrite($fh, 'ciao');
> 
>     fclose($fh);
> 
>             echo $path;
> 
> } 
> 
>  
> 
> does someone have an answer?
> 
> 

Yes, I believe you need to elaborate more on your objectives for the
code and what exactly you mean by the file being written twice. From the
code snippet above, it seems as though you are just going to overwrite a
file and destroy it's contents, not write to it twice.

This isn't being called from any sort of loop, is it?

- --
Christopher Weldon, ZCE
President & CEO
Cerberus Interactive, Inc.
cweldon@xxxxxxxxxxxxxxxxxx
979.739.5874
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFCGnIZxvk7JEXkbERAj4OAKCVUc3lLkx7JcbwYavK/Qc/DYKtEQCfbU9w
EevaaQyHxc87B7qFwZxS0E4=
=BbS2
-----END PGP SIGNATURE-----

Chiacchiera con i tuoi amici in tempo reale! 
 http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux