yii\httpclient\Request::addContent PHP Method

addContent() public method

Adds a content part for multi-part content request.
public addContent ( string $name, string $content, array $options = [] )
$name string part (form input) name.
$content string content.
$options array content part options, valid options are: - contentType - string, part content type - fileName - string, name of the uploading file - mimeType - string, part content type in case of file uploading
    public function addContent($name, $content, $options = [])
    {
        $multiPartContent = $this->getContent();
        if (!is_array($multiPartContent)) {
            $multiPartContent = [];
        }
        $options['content'] = $content;
        $multiPartContent[$name] = $options;
        $this->setContent($multiPartContent);
        return $this;
    }