PHP FTP上下文选项
介绍
下面列出了 http://和https://传输的上下文选项-
本示例说明如何允许 fopen() 覆盖FTP站点上的文件。
示例
<?php
$ftp_path = 'ftp://username:password@example.com/example.txt';
$stream_options = array('ftp' => array('overwrite' => true));
$stream_context = stream_context_create($stream_options);
$fh = fopen($ftp_path, 'w', 0, $stream_context);
fputs($fh, 'Hello World');
fclose($fh);
?>