php - JSON Export Function -
i have little situation. created function should let me export arrays in json format.
this code far:
function export( $option_values ) { $json = json_encode( $option_values ); $filename= '_' . date('y-m-d_h.i.s', time()); $filename= '_wp-' . get_bloginfo('version'); $filename= '.json'; header( "content-disposition: attachment; filename='$filename'" ); header( 'content-type: text/json'); header( 'content-length: ' . mb_strlen( $json ) ); header( 'connection: close');
i error message:
warning: cannot modify header information - headers sent.
how can complete task?
somewhere in code outputting something. can intentional (with statements echo
, print
, etc.), or unintentional loading php-script linefeed after closing php-tag (?>
).
remove output , go.
Comments
Post a Comment