How to copy a file from one directory to another using PHP?

后端 未结 8 920
暗喜
暗喜 2020-11-28 06:38

Say I\'ve got a file test.php in foo directory as well as bar. How can I replace bar/test.php with foo/test.php

8条回答
  •  醉话见心
    2020-11-28 07:14

    You can use both rename() and copy().

    I tend to prefer to use rename if I no longer require the source file to stay in its location.

提交回复
热议问题