开发者

Duplicating / Creating a copy of the original file

I have a file test.php in that i want to add a PHP script in such a way that whenever test.php is being exceuted/opened it should copy itself to a directory 开发者_Go百科/copies/test.php How do i do that ? and it would be better if i could rename it.


This'll do it:

<?php
  copy(__FILE__,dirname(__FILE__).'/copies/'.basename(__FILE__));
?>


you want to copy all test.php php code or result from that code?


This sounds like a very zoomed-in solution to a problem that might be much easier to solve. Have you thought about sharing the problem as a whole? You never know...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜