PHP ftp_set_option() 函數(shù)
定義和用法
ftp_set_option() 函數(shù)設(shè)置各種 FTP 運(yùn)行時(shí)選項(xiàng)。
語(yǔ)法
ftp_set_option(ftp_connection,option,value)
參數(shù) | 描述 |
---|---|
ftp_connection | 必需。規(guī)定要使用的 FTP 連接(FTP 連接的標(biāo)識(shí)符)。 |
option |
必需。規(guī)定要?jiǎng)h設(shè)置的運(yùn)行時(shí)選項(xiàng)?赡艿闹担
詳細(xì)信息見(jiàn)下面的說(shuō)明。 |
value | 必需。設(shè)置 option 參數(shù)的值。 |
說(shuō)明
FTP_TIMEOUT_SEC 選項(xiàng)改變網(wǎng)絡(luò)傳輸?shù)某瑫r(shí)時(shí)間。參數(shù) value 必須為整數(shù)且大于 0。默認(rèn)的超時(shí)時(shí)間為 90 秒。
當(dāng) FTP_AUTOSEEK 選項(xiàng)打開(kāi)時(shí),帶 resumepos 或 startpos 參數(shù)的 GET 或 PUT 請(qǐng)求將先檢索到文件中指定的位置。此選項(xiàng)默認(rèn)是打開(kāi)的。
例子
<?php
$conn = ftp_connect("ftp.testftp.com") or die("Could not connect");
ftp_login($conn,"admin","ert456");
ftp_set_option($conn,FTP_TIMEOUT_SEC,120);
ftp_close($conn);
?>