[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

php - create file and write some content

Posted on 2011-10-16
1
Medium Priority
?
287 Views
Last Modified: 2012-05-12
Hi E's, I need a solution for create a file and in this file write some contain.

I have this lines of code that I want write in the new file:
==========================
$string = "<html>
<head>
</head>
<body>
</body>
</html>";
==========================
What I have to do after create the file with ($createfile = fopen("$newfile", 'w') or die("error");)?

The best regards, JC
0
Comment
Question by:Pedro Chagas
1 Comment
 
LVL 22

Accepted Solution

by:
Kim Walker earned 2000 total points
ID: 36976816
fwrite($createfile,$string);
fclose($createfile);

Open in new window


See: http://us3.php.net/manual/en/function.fwrite.php
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The title says it all. Writing any type of PHP Application or API code that provides high throughput, while under a heavy load, seems to be an arcane art form (Black Magic). This article aims to provide some general guidelines for producing this typ…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses
Course of the Month19 days, 14 hours left to enroll

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question