![]() |
![]() |
![]()
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 |
|
|
![]() |
![]()
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 ![]() -------------------- Chęci to nie wszystko, trzeba działać. B. Lee |
|
|
![]()
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...
|
|
|
![]()
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?
|
|
|
![]()
Post
#5
|
|
![]() Grupa: Zarejestrowani Postów: 875 Pomógł: 122 Dołączył: 2.02.2008 Ostrzeżenie: (0%) ![]() ![]() |
A nie lepiej file_put_contents" title="Zobacz w manualu PHP" target="_manual z LOCK_EX? Też można... ![]() "This function is identical to calling fopen(), fwrite() and fclose() successively" ![]() |
|
|
![]()
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"
![]() 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 |
|
|
![]()
Post
#7
|
|
Grupa: Zarejestrowani Postów: 2 Pomógł: 0 Dołączył: 7.02.2008 Ostrzeżenie: (0%) ![]() ![]() |
|
|
|
![]() ![]() |
![]() |
Wersja Lo-Fi | Aktualny czas: 14.08.2025 - 01:57 |