php - json_encode not working with strip_tags -
i want insert input list json looks strange. use strip_tags
fix memory leak. here code , outputted json
code:
<?php echo '<meta charset="utf-8">'; include_once('libs/simplehtmldom/simple_html_dom.php'); $html = file_get_html('https://hugo.events/event/2017'); // find links foreach($html->find('ul#eventlandinlineuplist') $element) $encoded = strip_tags($element); echo json_encode($encoded);
and json has been outputted:
"\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfedde le grand\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tkensington\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttyphoon\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsunday sun\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbl\u00d8f\n\t\t\t\t\t\t\t\t\t\t\t\t\t"
i hope can me. in advance
you can use trim()
remove whitespace there.
Comments
Post a Comment