| ページ一覧 | ブログ | twitter |  書式 | 書式(表) |

MyMemoWiki

差分

ナビゲーションに移動 検索に移動
786 バイト追加 、 2021年3月12日 (金) 04:44
|}
<blockquote>Authパッケージには、ドライバに必要なテーブルを作成するためのマイグレーションファイルが含まれる。作成要否は、Auth設定ファイルで決定</blockquote>
 
==Tips==
 
===WebAPI JSONデータを取得する===
----
<pre>
<?php
 
class Controller_JsonSample extends Controller
{
function action_index() {
 
$url = 'http://hoge/json-api-sample.json';
$curl = Request::forge($url, 'curl');
 
$curl->set_method('get');
$curl->set_params(array());
 
$response = $curl->execute()->response();
$json_data = json_decode($response);
$data = [
'http_response_code' => $response->status,
'json_str' => htmlspecialchars(json_encode($json_data, JSON_PRETTY_PRINT), ENT_QUOTES, 'UTF-8'),
'somevalue' => $json_date->somevalue,
];
 
$view = View::forge('jsonsample/jsonsample', $data);
return Response::forge($view);
}
}
</pre>

案内メニュー