CURLFile 類

(PHP 5 >= 5.5.0, PHP 7, PHP 8)

簡介

CURLFile 應(yīng)該與選項(xiàng) CURLOPT_POSTFIELDS 一同使用用于上傳文件。

類摘要

class CURLFile {
/* 屬性 */
public $name;
public $mime;
public $postname;
/* 方法 */
public __construct(string $filename, string $mimetype = ?, string $postname = ?)
public getFilename(): string
public getMimeType(): string
public getPostFilename(): string
public setMimeType(string $mime): void
public setPostFilename(string $postname): void
}

屬性

name

待上傳文件的名稱

mime

文件的 MIME type(默認(rèn)是application/octet-stream)。

postname

上傳數(shù)據(jù)中的文件名稱(默認(rèn)為屬性 name )。

參見

目錄