Last active
December 15, 2015 18:58
-
-
Save narita1980/5307201 to your computer and use it in GitHub Desktop.
[PHP]str_get_htmlの説明(PHP Simple HTML DOM Parser)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* get html dom from string | |
* | |
* @param string $str html domを取得する対象の文字列 | |
* | |
* @param bool $lowercase Force the selectors to all be lowercase. | |
* | |
* @param bool $forceTagsClosed Forcing tags to be closed implies that we don't trust the html, | |
* but it can lead to parsing errors if we SHOULD trust the html. | |
* | |
* @param string $target_charset $strの文字コード | |
* define('DEFAULT_TARGET_CHARSET', 'UTF-8'); | |
* | |
* @param bool $stripRN strip out the \r \n's. | |
* true: strip out(\r, \n⇒" ") false:nothing do | |
* | |
* @param string $defaultBRText the string to quote | |
* define('DEFAULT_BR_TEXT', "\r\n"); | |
* | |
* @param string $defaultSpanText If this node is a span... | |
* add a space at the end of it so multiple spans don't run into each other. | |
* This is plaintext after all. | |
* define('DEFAULT_SPAN_TEXT', " "); | |
*/ | |
function str_get_html( | |
$str, | |
$lowercase=true, | |
$forceTagsClosed=true, | |
$target_charset = DEFAULT_TARGET_CHARSET, | |
$stripRN=true, | |
$defaultBRText=DEFAULT_BR_TEXT, | |
$defaultSpanText=DEFAULT_SPAN_TEXT | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment