Bluehost.com Web Hosting $6.95

file_put_contents flags

This is a discussion on file_put_contents flags within the alt.comp.lang.php forums, part of the PHP Programming Forums category; The documentation for "file_put_contents" contains this: file_put_contents ( string filename, mixed data [, int flags [, resource context]] ) and this: flags ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-29-2006
McKirahan
 
Posts: n/a
Default file_put_contents flags

The documentation for "file_put_contents" contains this:
file_put_contents ( string filename, mixed data [, int flags [, resource
context]] )
and this:
flags can take FILE_USE_INCLUDE_PATH, FILE_APPEND and/or LOCK_EX

What isn't clear is how FILE_APPEND and LOCK_EX are used together.

This works:
file_put_contents($name,$data,FILE_APPEND);
but this doesn't:
file_put_contents($name,$data,FILE_APPEND LOCK_EX);
and this doesn't:
file_put_contents($name,$data,FILE_APPEND, LOCK_EX);

What am I doing wrong? I can find no examples that use both.

Thanks in advance.


Reply With Quote
  #2 (permalink)  
Old 12-29-2006
McKirahan
 
Posts: n/a
Default Re: file_put_contents flags

"McKirahan" <News@McKirahan.com> wrote in message
news:XqadnRAu4eJWPwnYnZ2dnUVZ_rGinZ2d@comcast.com. ..
> The documentation for "file_put_contents" contains this:
> file_put_contents ( string filename, mixed data [, int flags [,

resource
> context]] )
> and this:
> flags can take FILE_USE_INCLUDE_PATH, FILE_APPEND and/or LOCK_EX
>
> What isn't clear is how FILE_APPEND and LOCK_EX are used together.
>
> This works:
> file_put_contents($name,$data,FILE_APPEND);
> but this doesn't:
> file_put_contents($name,$data,FILE_APPEND LOCK_EX);
> and this doesn't:
> file_put_contents($name,$data,FILE_APPEND, LOCK_EX);


Nevermind!

file_put_contents($name,$data,FILE_APPEND+LOCK_EX) ;


Reply With Quote
  #3 (permalink)  
Old 12-30-2006
clb
 
Posts: n/a
Default Re: file_put_contents flags



McKirahan wrote:

> The documentation for "file_put_contents" contains this:
> file_put_contents ( string filename, mixed data [, int flags [, resource
> context]] )
> and this:
> flags can take FILE_USE_INCLUDE_PATH, FILE_APPEND and/or LOCK_EX
>
> What isn't clear is how FILE_APPEND and LOCK_EX are used together.
>
> This works:
> file_put_contents($name,$data,FILE_APPEND);
> but this doesn't:
> file_put_contents($name,$data,FILE_APPEND LOCK_EX);
> and this doesn't:
> file_put_contents($name,$data,FILE_APPEND, LOCK_EX);
>
> What am I doing wrong? I can find no examples that use both.
>
> Thanks in advance.


Just a thought, try

file_put_contents($name,$data,FILE_APPEND | LOCK_EX);

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 06:33 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0