Switch to English?
Yes
Переключитись на українську?
Так
Переключиться на русскую?
Да
Przełączyć się na polską?
Tak
Post your project for free and start receiving proposals from freelancers within minutes after publication!

PHP запись в файл

PHP

  1. 68    1  0
    1 day2 USD

    Сделаю за час, большой опыт в РНР. Пишите, если заинтересует.

  2. 151    9  0
    1 day2 USD

    $fp = fopen ( "filename.txt","w" );
    flock ( $fp,LOCK_EX ); // БЛОКИРОВКА ФАЙЛА
    ... //работа с файлом
    flock ( $fp,LOCK_UN ); // СНЯТИЕ БЛОКИРОВКИ
    fclose ( $fp );

    if ( !is_writable ( "filename.txt" ) ) {
    echo "файл filename.txt не доступен для записи";
    }

    источник http://www.php.su/flock()

  3. 1941    72  4   3
    1 day22 USD

    Добрый вечер!
    Для Вашей задачи есть решения поизящнее, суть предельно ясна, готов выполнить.
    Читайте отзывы, обращайтесь :)

  4. 418    142  0
    1 day4 USD

    Здравствуйте.

    Возьмусь прямо сейчас. Сделаю все быстро и качественно.

  5. 2748    153  0   1
    1 day4 USD

    Здравствуйте. Готов сделать лучше этого.

  6. 117  
    1 day31 USD

    Привет,
    Я из Армении, и у меня 3-летний опыт работы в области веб-разработки, если хотите, я могу работать на вас.
    Я посылаю это, чтобы попросить ваше одобрение, которое поможет мне создать мой профиль на freelancehunt.com и выиграть больше работы.
    Нарек Варданян

  7. Another 6 proposals concealed
  • Vanya Kutuzov
    2 January 2019, 19:04 |

    это устаревший метод

  • Dmitry Andrushchenko
    2 January 2019, 19:56 |

    Скрипт в который я вношу правку тоже устаревший, переписывать сейчас никто не будет, библиотека создана 6 лет назад.


    Я надеюсь так надежнее?


    $fp = fopen('2.csv', 'w'); 

    flock($fp, LOCK_EX + LOCK_NB)

    fwrite($fp, implode('', $lines)); 

    flock($fp,  LOCK_UN);



    Чем без блокировки вообще?

  • Profile deleted
    2 January 2019, 19:13 |

    В момент работы с файлом другой скрипт не сможет с ним что-либо сделать до завершения процесса чтения/записи предыдущим потоком.

  • Profile deleted
    2 January 2019, 19:52 |

    Для защиты файла с которым работает текущий процесс от изменений со стороны любого другого процесса в операционных системах применяются так называемые блокировки (locks). Для этого в PHP используется функция flock(). Пока на файле стоит блокировка все остальные делающие записать что-либо в этот файл стоят в очереди и дожидаются снятия блокировки. Подробнее почитать можно вот здесь - https://metanit.com/web/php/5.3.php, но в принципе можно найти и другие инструкции с примерами. Так что вам просто надо пару строчек в код добавить и всё.

  • Profile deleted
    2 January 2019, 21:59 |

    Я один юзаю file_get_contents и file_put_contents?

  • Dmitry Andrushchenko
    2 January 2019, 22:17 |

    Я один юзаю file_get_contents и file_put_contents?

    Это позволит лишь добавить последнюю строку, но не удалить..

    А нужно подобие стека, последнюю положил строку, последнюю и взял.

  • Profile deleted
    2 January 2019, 22:24 |

    file_get_contents

    explode("\n")

    ....

    implode("\n")

    file_put_contents

Current freelance projects in the category PHP

Resolve the loading issue on the PrestaShop website hosting

The website requires more and more resources each month. The host's response: During the server check, increased load from the MySQL database server was recorded. At times of the 500 error, the MySQL process uses a significant portion of CPU resources, which can lead to unstable…

PHPDatabases & SQL ∙ 20 hours 50 minutes back ∙ 26 proposals

Integration needed: KeyCRM → Cash Register Kashalot

It is necessary to set up integration between KeyCRM and the Cash Register Kahalot. When placing an order in KeyCRM, the data must be automatically transmitted to Kahalot: • order information • products, nomenclature • prices • quantity More details in private.

Content Management SystemsPHP ∙ 22 hours 10 minutes back ∙ 25 proposals

A WordPress site using the Kadence theme and Kadence Blocks.

223 USD

We need to create a website on WordPress using the Kadence theme and Kadence Blocks. There will be no online store (although it may be added in the future). We need a homepage and several internal pages. The graphics are already prepared, the layout structure is mostly defined,…

Content Management SystemsPHP ∙ 2 days 7 hours back ∙ 37 proposals

Development of 2 SEO-oriented websites for selling spare parts (ATVs and special equipment)

Development of Two Specialized Websites for Selling Spare PartsGeneral Information It is necessary to develop two specialized websites: Spare parts for ATVs, UTVs, SSVs, and other similar equipment. Spare parts for special equipment. Existing company website:…

PHPWeb Programming ∙ 3 days 5 hours back ∙ 76 proposals

Development of a WordPress website

22 USD

We are looking for a contractor to develop a custom website on WordPress for a jewelry store. The first stage will be a consultation.

Content Management SystemsPHP ∙ 5 days 20 hours back ∙ 72 proposals

Client
Project published
7 years back
193 views