CURLFile 类

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

简介

此类或 CURLStringFile 应该与 CURLOPT_POSTFIELDS 一同使用用于上传文件。

不允许反序列化 CURLFile 实例。自 PHP 7.4.0 起,首先禁止序列化。

类摘要

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

属性

name

待上传的文件名。

mime

文件的 MIME 类型(默认是 application/octet-stream)。

postname

上传数据中的文件名(默认为 name 属性)。

目录

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top