Add the file php
// LOCK_EX will prevent anyone else writing to the file at the same time
// PHP_EOL will add linebreak after each line
$txt = "data-to-add";
$myfile = file_put_contents('logs.txt', $txt.PHP_EOL , FILE_APPEND | LOCK_EX);
// Second option is this
$myfile = fopen("logs.txt", "a") or die("Unable to open file!");
$txt = "user id date";
fwrite($myfile, "\n". $txt);
fclose($myfile);$log_content="This line is logged on 2020-08-14 09:55:00";
$myfile = fopen("log.txt", "a") or die("Unable to open file!");
fwrite($myfile, $log_content);
fclose($myfile);
Also in PHP:
- check if a string contains a word in php
- create random unique string
- error show all php
- current time in php
- array shift php
- avoir la date php
- How to change add to cart button in wordpress
- Laravel store multiple files
- Hie date format php
- file to base64
- filter_var filter_validate_url
- AWS HTTP error: Error creating resource: [message] fopen(): SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed
- Call Python From PHP And Get Return Code
- ERROR: Module mpm_event is enabled - cannot proceed due to conflicts. It needs to be disabled first! Considering conflict mpm_worker for mpm_prefork: ERROR: Could not enable dependency mpm_prefork for php7.2, aborting
- PHP message: PHP Fatal error: Uncaught TypeError: Argument 2 passed to Magento\Eav\Model\Attribute\Data\Text::validateLength() must be of the type string, null given
- euclid algorithm
- array should not be empty php
- download and install laveral
- calculate person age by birthdate php
- ajax call php
- artisan laravel install
- array unique values
- character lenght php
- convert json to array php