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

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

android - CoordinatorLayout, FAB and container layout conflict -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -