Hướng dẫn soundasleep/html2text - soundasleep/html2text
HTML2TEXT là một tập lệnh rất đơn giản sử dụng các phương thức DOM để chuyển đổi HTML thành định dạng tương tự như những gì sẽ được trình duyệt hiển thị - hoàn hảo cho những nơi bạn cần biểu diễn văn bản nhanh. Ví dụ: Sẽ được chuyển đổi thành:
Xem bài đăng trên blog gốc hoặc câu trả lời Stackoverflow liên quan. Cài đặtBạn có thể sử dụng trình soạn thảo để thêm gói vào dự án của mình: { "require": { "soundasleep/html2text": "~1.1" } } Và sau đó sử dụng nó khá đơn giản: $text = \Soundasleep\Html2Text::convert($html); Bạn cũng có thể bao gồm Tùy chọn
Được đặt thành 0 thành không kết xuất các liên kết là 3, mà chỉ là 4.$options = array( 'ignore_errors' => true, // other options go here ); $text = \Soundasleep\Html2Text::convert($html, $options); Truyền các tùy chọn cùng như một đối số thứ hai cho Hello, World! This is some e-mail content. Even though it has whitespace and newlines, the e-mail converter will handle it correctly. Even mismatched tags. A div Another div A div within a div [A link](http://foo.com) 5, ví dụ:Xét nghiệm Một số thử nghiệm rất cơ bản được cung cấp trong thư mục Hello, World! This is some e-mail content. Even though it has whitespace and newlines, the e-mail converter will handle it correctly. Even mismatched tags. A div Another div A div within a div [A link](http://foo.com) 6. Chạy chúng với Hello, World! This is some e-mail content. Even though it has whitespace and newlines, the e-mail converter will handle it correctly. Even mismatched tags. A div Another div A div within a div [A link](http://foo.com) 7.Xử lý sự cốLớp 'Domdocument' không tìm thấy Bạn cần cài đặt tiện ích mở rộng PHP XML cho phiên bản PHP của mình. ví dụ. Hello, World! This is some e-mail content. Even though it has whitespace and newlines, the e-mail converter will handle it correctly. Even mismatched tags. A div Another div A div within a div [A link](http://foo.com) 8Giấy phép Hello, World! This is some e-mail content. Even though it has whitespace and newlines, the e-mail converter will handle it correctly. Even mismatched tags. A div Another div A div within a div [A link](http://foo.com) 9 được cấp phép theo MIT, làm cho nó phù hợp cho cả các dự án Eclipse và GPL.Các phiên bản khác Cũng xem HTML2TEXT_RUBY, một triển khai Ruby.Bình luận Brusch đã thêm một cam kết tham chiếu vấn đề này
…precated methods from Mail (#7644)
* Replace html2text/html2text with soundasleep/html2text and removed deprecated methods from Mail - fixes #7602
* Still allow to modify Html2Text options
* Update lib/Mail.php
Co-authored-by: Jacob Dreesen <>
* Feedback @jdreesen & @blankse
Co-authored-by: Jacob Dreesen <> Ngày 2 tháng 12 năm 2020 Roland4432 đã thúc đẩy cam kết với Roland4432/Pimcore đã đề cập đến vấn đề này…precated methods from Mail (pimcore#7644)
* Replace html2text/html2text with soundasleep/html2text and removed deprecated methods from Mail - fixes pimcore#7602
* Still allow to modify Html2Text options
* Update lib/Mail.php
Co-authored-by: Jacob Dreesen <>
* Feedback @jdreesen & @blankse
Co-authored-by: Jacob Dreesen <> |