PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Old December 25th, 2016, 08:55 PM
adamtran adamtran is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Dec 2016
Posts: 1 adamtran User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 39 sec
Reputation Power: 0
php5 - How to create folder with PHP code?

Can we create folder with PHP code? I want that whenever a new user create his new account his folder automatically creates and a PHP file also created.Is this possible?

Reply With Quote
Old December 25th, 2016, 09:36 PM
cwf's Avatar
cwf cwf is online now
Super Moderator
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 391 cwf User rank is Private First Class (20 - 50 Reputation Level)cwf User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Weeks 1 Day 17 h 2 m 56 sec
Reputation Power: 11
Yes, php has the ability to create folders and copy/make files, however, any per user content system you may have seen that you are trying to reproduce wasn't done with actual folders and files. They use url rewriting to map the requested user and file name to a single file that retrieves the requested information to display on the single page.

Reply With Quote
Old May 31st, 2017, 01:13 AM
PaulShipman PaulShipman is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: May 2017
Posts: 4 PaulShipman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 12 m 38 sec
Reputation Power: 0
This version will create a file and folder at the same time and show it on screen after.

<?php

// change the name below for the folder you want
$dir = "new_folder_name";

$file_to_write = 'test.txt';
$content_to_write = "The content";

if( is_dir($dir) === false )
{
mkdir($dir);
}

$file = fopen($dir . '/' . $file_to_write,"w");

// a different way to write content into
// fwrite($file,"Hello World.");

fwrite($file, $content_to_write);

// closes the file
fclose($file);

// this will show the created file from the created folder on screen
include $dir . '/' . $file_to_write;

?>

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > php5 - How to create folder with PHP code?


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap