How to write into a file in PHP

0 votes

I have this script on one free PHP-supporting server:

<html>
<body>

<?php
file = fopen("lidn.txt","a");


fclose(file);
?>

</body>
</html>

It creates the file lidn.txt, but it's empty.

How can I create a file and write something into it?

Jun 20, 2022 in PHP by Kithuzzz
• 38,000 points
450 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In PHP

0 votes
1 answer

How to write CSV To File Without Enclosures In PHP?

Hello @kartik, The warnings about foregoing enclosures are ...READ MORE

answered Nov 9, 2020 in PHP by Niroj
• 82,840 points
4,302 views
0 votes
0 answers

How to open a file named index.php which is in htdocs/project1 folder in xampp?

I have a folder named project1 in ...READ MORE

May 29, 2022 in PHP by Kichu
• 19,040 points
2,959 views
0 votes
0 answers
0 votes
1 answer

How to implement a callback in PHP?

Hello, Implementation of a callback is done like ...READ MORE

answered Apr 15, 2020 in PHP by Niroj
• 82,840 points
985 views
0 votes
1 answer

How can I connect to a Tor hidden service using CURL in PHP?

Hello @kartik, I use Privoxy and cURL to scrape Tor ...READ MORE

answered May 19, 2020 in PHP by Niroj
• 82,840 points
5,320 views
0 votes
1 answer

How to concatenate text from multiple rows into a single text string in SQL server?

Hello @kartik, Use COALESCE: DECLARE @Names VARCHAR(8000) SELECT @Names = ...READ MORE

answered Jul 21, 2020 in PHP by Niroj
• 82,840 points
3,077 views
0 votes
1 answer

Move_uploaded_file() function is not working

The file will be stored in a ...READ MORE

answered Feb 22, 2022 in Others by Aditya
• 7,680 points
3,326 views
0 votes
0 answers

How to use Unlink() function

I tried using the PHP unlink() function to ...READ MORE

Jun 13, 2022 in PHP by narikkadan
• 63,600 points
418 views
0 votes
0 answers

Read a plain text file with php

How do I read all the information ...READ MORE

Jun 26, 2022 in PHP by narikkadan
• 63,600 points
677 views
+1 vote
2 answers

Scp Php files into server using gradle

Tru something like this: plugins { id ...READ MORE

answered Oct 11, 2018 in DevOps & Agile by lina
• 8,220 points
1,561 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP