mb_encode_mimeheader

(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)

mb_encode_mimeheaderEncode string for MIME header

Beschreibung

mb_encode_mimeheader(
    string $string,
    ?string $charset = null,
    ?string $transfer_encoding = null,
    string $newline = "\r\n",
    int $indent = 0
): string

Encodes a given string string by the MIME header encoding scheme.

Parameter-Liste

string

The string being encoded. Its encoding should be same as mb_internal_encoding().

charset

charset specifies the name of the character set in which string is represented in. The default value is determined by the current NLS setting (mbstring.language).

transfer_encoding

transfer_encoding specifies the scheme of MIME encoding. It should be either "B" (Base64) or "Q" (Quoted-Printable). Falls back to "B" if not given.

newline

newline specifies the EOL (end-of-line) marker with which mb_encode_mimeheader() performs line-folding (a » RFC term, the act of breaking a line longer than a certain length into multiple lines. The length is currently hard-coded to 74 characters). Falls back to "\r\n" (CRLF) if not given.

indent

Indentation of the first line (number of characters in the header before string).

Rückgabewerte

A converted version of the string represented in ASCII.

Changelog

Version Beschreibung
8.0.0 charset and transfer_encoding are nullable now.

Beispiele

Beispiel #1 mb_encode_mimeheader() example

<?php
$name 
"太郎"// kanji
$mbox "kru";
$doma "gtinn.mon";
$addr '"' addcslashes(mb_encode_mimeheader($name"UTF-7""Q"), '"') . '" <' $mbox "@" $doma ">";
echo 
$addr;
?>

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

"=?UTF-7?Q?+WSqQzg-?=" <kru@gtinn.mon>

Anmerkungen

Hinweis:

This function isn't designed to break lines at higher-level contextual break points (word boundaries, etc.). This behaviour may clutter up the original string with unexpected spaces.

Siehe auch

Hier Kannst Du einen Kommentar verfassen


Bitte gib mindestens 10 Zeichen ein.
Wird geladen... Bitte warte.
* Pflichtangabe
Es sind noch keine Kommentare vorhanden.

Was genau bedeutet "Vibe Coding"? Ein tiefgehender Blick für Entwickler

In der Welt der Softwareentwicklung gibt es unzählige Wege, wie man an ein Projekt herangeht. Manche schwören auf strikte Planung, andere auf bewährte Algorithmen und wieder andere lassen sich von etwas ganz anderem leiten: ihrem Gefühl. ...

admin

Autor : admin
Kategorie: Software & Web-Development

PHP cURL-Tutorial: Verwendung von cURL zum Durchführen von HTTP-Anfragen

cURL ist eine leistungsstarke PHP-Erweiterung, die es Ihnen ermöglicht, mit verschiedenen Servern über verschiedene Protokolle wie HTTP, HTTPS, FTP und mehr zu kommunizieren. ...

TheMax

Autor : TheMax
Kategorie: PHP-Tutorials

Midjourney Tutorial - Anleitung für Anfänger

Über Midjourney, dem Tool zur Erstellung digitaler Bilder mithilfe von künstlicher Intelligenz, gibt es ein informatives Video mit dem Titel "Midjourney Tutorial auf Deutsch - Anleitung für Anfänger" ...

Mike94

Autor : Mike94
Kategorie: KI Tutorials

Tutorial veröffentlichen

Tutorial veröffentlichen

Teile Dein Wissen mit anderen Entwicklern weltweit

Du bist Profi in deinem Bereich und möchtest dein Wissen teilen, dann melde dich jetzt an und teile es mit unserer PHP-Community

mehr erfahren

Tutorial veröffentlichen

PHP session lost after AJAX reload

Hi everyone, I’m running into a strange issue with PHP sessions in my project. I have a login system that works fine on normal page loads, but ...

Geschrieben von mikasabaggins am 20.04.2026 07:02:03
Forum: PHP Developer Forum
IGGM | Diablo 4: Lord of Hatred Copies Giveaway + Prep Event

The next expansion for Diablo IV — Lord of Hatred — arrives on April 28, bringing with it a massive wave of new content, character builds, and ...

Geschrieben von Cjacker am 20.04.2026 04:01:19
Forum: Apps und PHP Script Gesuche
IGGM April Offers 8% Off ARC Raiders Flashpoint Blueprints

Hey, Raiders! Did ARC Raiders Flashpoint Update live up to your expectations? Let me share my thoughts first: Flashpoint Update seems to have cran ...

Geschrieben von Cjacker am 20.04.2026 03:55:53
Forum: Apps und PHP Script Gesuche
IGGM: Buying Cheap MLB The Show 26 Stubs | All Platform | Live Update Price

I believe every MLB The Show 26 player dreams of assembling an invincible Diamond Dynasty lineup; however, a lack of sufficient Stubs - the game's ...

Geschrieben von Cjacker am 20.04.2026 03:50:21
Forum: Apps und PHP Script Gesuche