PHPMailer\PHPMailer\PHPMailer::html2text PHP Méthode

html2text() public méthode

This is used by msgHTML(). Note - older versions of this function used a bundled advanced converter which was been removed for license reasons in #232 Example usage: Use default conversion $plain = $mail->html2text($html); Use your own custom converter $plain = $mail->html2text($html, function($html) { $converter = new MyHtml2text($html); return $converter->get_text(); });
public html2text ( string $html, boolean | callable $advanced = false ) : string
$html string The HTML text to convert
$advanced boolean | callable Any boolean value to use the internal converter, or provide your own callable for custom conversion.
Résultat string
    public function html2text($html, $advanced = false)
    {
        if (is_callable($advanced)) {
            return call_user_func($advanced, $html);
        }
        return html_entity_decode(trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\\/\\1>/si', '', $html))), ENT_QUOTES, $this->CharSet);
    }