大家好,我有问题,这个代码必须给文件下载在wordpress后端,但它给我杰森代码,任何人可以帮助这里我的代码
$oprion_name_theme = $this->theme->options['theme_options_field'];
$shadyssa_options = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options WHERE option_name like '%$oprion_name_theme%'");
$resul = $shadyssa_options[0] ;
$result = (array) $resul ;
ob_start() ;
$output = json_encode($result) ;
header("Content-type: application/octet-stream") ;
header("Content-Disposition: attachment; filename='test.json'");
header( 'Content-Length: ' . strlen( $output ) );
echo $output;提前感谢
发布于 2012-12-18 18:32:20
这里有拼写错误:
$result = (array) $resul ;你想下载文件吗?但是您将输出为json
header("Content-type: application/octet-stream") ;
header("Content-Disposition: attachment; filename='test.json'");你想要哪一个?
https://stackoverflow.com/questions/11073420
复制相似问题