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 | |
class myApiActions extends sfActions | |
{ | |
// ...(中略)... | |
/* | |
* 条件真のときにエラーレスポンスを返す | |
* |
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 | |
use_helper('MyJSON'); | |
// アクション内で、配列形式でレスポンス用のデータを入れてます | |
$json = json_encode($sf_data->getRaw('data')); | |
// デバッグ用にフォーマット | |
if(sfConfig::get('app_json_pretty_print')) | |
{ |
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 | |
// http://www.php.net/manual/ja/function.json-encode.php#80339 | |
// by PHP Documentation Group | |
function json_format($json) | |
{ | |
$tab = " "; | |
$new_json = ""; | |
$indent_level = 0; | |
$in_string = false; |
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 | |
class myApiActions extends sfActions | |
{ | |
public function postExecute() | |
{ | |
parent::postExecute(); | |
// テンプレートを | |
// apps/api/modules/shared/templates/jsonSuccess.php |
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 | |
class kayacActions extends sfActions | |
{ | |
public function executeThanks(sfWebRequest $request) | |
{ | |
// テンプレートを | |
// apps/api/modules/shared/templates/jsonSuccess.php | |
// に設定する。 | |
$this->setTemplate('json', 'shared'); |
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
default: | |
# content-type を設定 | |
http_metas: | |
content-type: application/json; charset=UTF-8 | |
# レイアウトを無効に | |
has_layout: false |
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
;; ;;; .emacs written by NAGATA Hiroaki (handlename.net) | |
(add-to-list 'load-path "~/.emacs.d/site-lisp/") | |
(require 'cl) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; General settings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
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
;;; .emacs written by NAGATA Hiroaki (handlename.net) | |
(add-to-list 'load-path "~/.emacs.d/site-lisp/") | |
(require 'cl) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; General settings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
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
;;; .emacs written by NAGATA Hiroaki (handlename.net) | |
(add-to-list 'load-path "~/.emacs.d/site-lisp/") | |
(require 'cl) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; general settings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
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
;;; .emacs written by NAGATA Hiroaki (handlename.net) | |
(add-to-list 'load-path "~/.emacs.d/site-lisp/") | |
(require 'cl) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; general settings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |