2016/01/26

PHPでjson出力するときのheaderについて



JSON形式のAPIをPHPで作るときに毎度使うのでメモ残し。 

JSONのHeaderを送って、連想配列データをJSONエンコードして出力
function print_json($data) {
    header("Content-Type: application/json; charset=utf-8");
    echo json_encode($data);
}

1 件のコメント:

  1. The King Casino Review - SEGPORTS.COM
    The King Casino review was written by Chief Executive Officer John Cook as follows: · Established in herzamanindir 2017, The King Casino was one https://jancasino.com/review/merit-casino/ of the https://septcasino.com/review/merit-casino/ first online worrione.com casinos available to US jancasino.com

    返信削除