PHP的copy()函數(shù)用于將文件從一個(gè)位置復(fù)制到另一個(gè)位置。
copy()函數(shù)的語(yǔ)法如下:
bool copy ( string $source , string $destination [, resource $context ] )
參數(shù)說明:
$source:要復(fù)制的文件的路徑。
$destination:復(fù)制文件的目標(biāo)路徑。
$context(可選):可使用stream_context_create()函數(shù)創(chuàng)建的流上下文資源,用于指定文件的訪問權(quán)限、HTTP請(qǐng)求頭等。
copy()函數(shù)在成功復(fù)制文件時(shí)返回true,否則返回false。