Created
February 12, 2012 17:49
-
-
Save ryo88c/1809886 to your computer and use it in GitHub Desktop.
結果を JSON として返すための output ハンドラ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* JSON出力 | |
* | |
* @param array $values 値 | |
* @param array $options オプション | |
* @return BEAR_Ro | |
* @author Ryo HAYASHI<ryo88c at gmail.com> | |
* @version 1.0.0 | |
* App/Resource/output/json.php | |
*/ | |
function outputJson($values, array $options) | |
{ | |
$body = json_encode($values); | |
$headers = array('X-BEAR-Output: JSON' => 'Content-Type: text/javascript+json; charset=utf-8'); | |
$ro = BEAR::factory('BEAR_Ro'); | |
$ro->setBody($body); | |
$ro->setHeaders($headers); | |
return $ro; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment