📜  带有 POST 文件的 guzzle 请求 - 任何代码示例

📅  最后修改于: 2022-03-11 14:59:08.328000             🧑  作者: Mango

代码示例1
$response = $client->request('POST', 'http://www.example.com/files/post', [
    'multipart' => [
        [
            'name'     => 'file_name',
            'contents' => fopen('/path/to/file', 'r')
        ],
        [
            'name'     => 'csv_header',
            'contents' => 'First Name, Last Name, Username',
            'filename' => 'csv_header.csv'
        ]
    ]
]);