Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Równoległy odczyt i zapis.
tommy5
post 7.02.2008, 12:43:09
Post #1





Grupa: Zarejestrowani
Postów: 2
Pomógł: 0
Dołączył: 7.02.2008

Ostrzeżenie: (0%)
-----


Witam,

Czy ktos wie jak w php (5) obslugiwane jest rownolegle otwarcie i zapis do pliku?
Konkretnie, mam na stronie fopen(_,"a");fputs(_);fclose(_);
Czy jezeli dana strone otworzy 100 klientow w tej samej chwili, to moze sie zdarzyc, ze zapisy sie pokryja, albo nadpisza ?

Pozdrawiam,
Tomek
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 6)
pjamorski
post 7.02.2008, 12:47:33
Post #2





Grupa: Zarejestrowani
Postów: 112
Pomógł: 0
Dołączył: 16.01.2008

Ostrzeżenie: (0%)
-----


Wydaje mi się, że nadpisanie w pliku bądź plikach musisz wcześniej zabezpieczyć jakimś skryptem sprawdzającym czy dany użytkownik już istnieje, jak tak to nie może zapisać jak nie to nieh wykona operacje czy coś takiego.

Za dużo nie powiem bo dopiero zaczynam stawać na nogi w PhP party.gif powodzenia


--------------------


Chęci to nie wszystko, trzeba działać.
B. Lee

Go to the top of the page
+Quote Post
nowotny
post 7.02.2008, 12:48:53
Post #3





Grupa: Zarejestrowani
Postów: 875
Pomógł: 122
Dołączył: 2.02.2008

Ostrzeżenie: (0%)
-----


Tym się zajmuje flock" title="Zobacz w manualu PHP" target="_manual OIMW...
Go to the top of the page
+Quote Post
specialplan
post 7.02.2008, 12:52:04
Post #4





Grupa: Zarejestrowani
Postów: 206
Pomógł: 21
Dołączył: 1.09.2006
Skąd: Edinburgh

Ostrzeżenie: (0%)
-----


A nie lepiej file_put_contents" title="Zobacz w manualu PHP" target="_manual z LOCK_EX?
Go to the top of the page
+Quote Post
nowotny
post 7.02.2008, 12:57:41
Post #5





Grupa: Zarejestrowani
Postów: 875
Pomógł: 122
Dołączył: 2.02.2008

Ostrzeżenie: (0%)
-----


Cytat(specialplan @ 7.02.2008, 12:52:04 ) *

Też można... smile.gif
"This function is identical to calling fopen(), fwrite() and fclose() successively" winksmiley.jpg
Go to the top of the page
+Quote Post
specialplan
post 7.02.2008, 12:58:53
Post #6





Grupa: Zarejestrowani
Postów: 206
Pomógł: 21
Dołączył: 1.09.2006
Skąd: Edinburgh

Ostrzeżenie: (0%)
-----


Otoz to, a prosciej i bardziej "php 5" winksmiley.jpg

Manual W3C to ladnie streszcza:

Cytat
Definition and Usage

The file_put_contents() writes a string to a file.

This function follows these rules when accessing a file:

1. If FILE_USE_INCLUDE_PATH is set, check the include path for a copy of *filename*
2. Create the file if it does not exist
3. Open the file
4. Lock the file if LOCK_EX is set
5. If FILE_APPEND is set, move to the end of the file. Otherwise, clear the file content
6. Write the data into the file
7. Close the file and release any locks

This function returns the number of character written into the file on success, or FALSE on failure.


Ten post edytował specialplan 7.02.2008, 13:01:58
Go to the top of the page
+Quote Post
tommy5
post 7.02.2008, 13:29:10
Post #7





Grupa: Zarejestrowani
Postów: 2
Pomógł: 0
Dołączył: 7.02.2008

Ostrzeżenie: (0%)
-----


Cytat(specialplan @ 7.02.2008, 12:58:53 ) *
Otoz to, a prosciej i bardziej "php 5" winksmiley.jpg

Manual W3C to ladnie streszcza:

Dzieki, o to chodzilo! smile.gif
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 14.08.2025 - 01:57