2012-03-17 124 views
0

我一直在爲我的網站創建一個用戶文件系統。我試圖讓它一旦有人在register.php頁面上註冊,它就會將我的錯誤文件夾中的index.php文件複製到用戶個人資料圖片文件夾中。 這裏是我的網頁文件夾的一棵樹: error/index.php, nofile.png index.php register.php members/0,1,2,3,4,etc to 30. - User id's, new one made whenever someone signs up. 。 我想從錯誤文件夾中的文件複製到成員/ $ id文件夾時有人註冊到我的網站。 請幫忙, -Matt。PHP文件複製功能

+1

這是什麼設計的總體目標是什麼?爲什麼你想要每個用戶的文件夾? – 2012-03-17 07:07:39

+0

你可以簡單地使用Apache的'mod_rewrite' – 2012-03-17 07:15:54

回答

0
在register.php使用功能複製

copy("error/index.php", "member/x/index.php"); 

其中x是分配給新用戶

該函數的第一個參數文件複製到第二個的數量。

+0

嘿,只是嘗試了代碼片段,但它仍然不會在members文件夾內的用戶id文件夾中創建index.php文件。 – 2012-03-17 07:17:56

+0

請提供管理文件副本的代碼片段! – 2012-03-17 07:19:58

+0

你是什麼意思? – 2012-03-17 07:36:43

0

試試這個

<?php 
copy ($_SERVER['DOCUMENT_ROOT']."/error/index.php" , $_SERVER['DOCUMENT_ROOT']."/members/".$id."/index.php"); // $id is the user id like folder id 
?> 

將複製的index.php

感謝

+0

我不知道爲什麼,但這是行不通的。 :( – 2012-03-17 07:27:55