Preserve Line Breaks - Simple HTML DOM Parser

后端 未结 5 2046
忘掉有多难
忘掉有多难 2021-02-01 18:21

When using PHP Simple HTML DOM Parser, is it normal that line breaks
tags are stripped out?

5条回答
  •  执笔经年
    2021-02-01 18:45

    You don't have to change all $stripRN to false, the only one that affects this behavior is at line 816 ``:

    // load html from string
    function load($str, $lowercase=true, $stripRN=false, $defaultBRText=DEFAULT_BR_TEXT) {
    

    Also consider to change line 988, because multibyte functions often are not installed on machines that do not deal with non-wester-european languages. Original line in v1.5 breaks the script immediately:

    if (function_exists('mb_detect_encoding')) { $charset = mb_detect_encoding($this->root->plaintext . "ascii", $encoding_list = array( "UTF-8", "CP1252" ) ); } else $charset === false;
    

提交回复
热议问题