PHPMailer\PHPMailer
PHPMailer::encodeFile()
Encode a file attachment in requested format. Returns an empty string on failure.
Метод класса: PHPMailer{}
Хуков нет.
Возвращает
Строку
.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->encodeFile( $path, $encoding );
- $path(строка) (обязательный)
- The full path to the file
- $encoding(строка)
- The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
По умолчанию: self::ENCODING_BASE64
Код PHPMailer::encodeFile() PHPMailer::encodeFile WP 6.7.1
protected function encodeFile($path, $encoding = self::ENCODING_BASE64) { try { if (!static::fileIsAccessible($path)) { throw new Exception($this->lang('file_open') . $path, self::STOP_CONTINUE); } $file_buffer = file_get_contents($path); if (false === $file_buffer) { throw new Exception($this->lang('file_open') . $path, self::STOP_CONTINUE); } $file_buffer = $this->encodeString($file_buffer, $encoding); return $file_buffer; } catch (Exception $exc) { $this->setError($exc->getMessage()); $this->edebug($exc->getMessage()); if ($this->exceptions) { throw $exc; } return ''; } }