[英]PHP move/copy temp file into a new directory and rename it ( performance )
[英]copy, move then rename file in php
我正在處理我網站的會員注冊部分,當會員注冊時,它會在 images/useravatars/(username) 中創建一個文件夾,但在文件夾 images/useravatars/ 中有一個 001.png 文件,我想復制、重命名(到用戶名)並粘貼到新成員新創建的文件夾中。 這是如何在 php 中完成的? 它是分配給所有新注冊會員的默認頭像。
看看復制功能。
bool copy ( string $source , string $dest [, resource $context ] )
基本上你想要做的只是一個步驟,你提供001.png
文件的路徑,然后使用copy(defaultImgPath, newUserImgPath);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.