{"id":594,"date":"2015-06-28T15:54:02","date_gmt":"2015-06-28T06:54:02","guid":{"rendered":"http:\/\/gomocool.net\/gomokulog\/?p=594"},"modified":"2015-06-28T15:54:02","modified_gmt":"2015-06-28T06:54:02","slug":"cakephp2-cakerequest%e3%81%a7%e3%83%87%e3%83%bc%e3%82%bf%e5%8f%97%e3%81%91%e5%8f%96%e3%82%8a","status":"publish","type":"post","link":"https:\/\/gomokulog.gomocool.net\/?p=594","title":{"rendered":"[CakePHP2] CakeRequest\u3067\u30c7\u30fc\u30bf\u53d7\u3051\u53d6\u308a"},"content":{"rendered":"<p>CakePHP2\u3067\u6295\u3052\u3089\u308c\u308b\u30c7\u30fc\u30bf\u306e\u53d7\u3051\u53d6\u308a\u65b9\u306f\u4f55\u7a2e\u985e\u304b\u3042\u308b\u3002<\/p>\n<p>\u4f8b\u3068\u3057\u3066\u4f7f\u7528\u3057\u3066\u3044\u308b\u53d7\u3051\u53d6\u308a\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u7269\u3068\u3059\u308b\u3002<\/p>\n<pre class=\"lang:php decode:true\">class RequestTestController extends AppController {\r\n\tpublic function index() {\r\n\t\tdebug($this-&gt;request-&gt;data);\r\n\t}\r\n}<\/pre>\n<hr \/>\n<p>&nbsp;<\/p>\n<h2>\u25a0Post\u3057\u305f\u5834\u5408<\/h2>\n<h3>\u30a2\u30af\u30bb\u30b9HTML:<\/h3>\n<pre class=\"lang:xhtml decode:true\">&lt;form action=\"\/request_test\/index\" method=\"POST\"&gt;\r\n\t&lt;input type=\"text\" name=\"Hoge\" value=\"Moge\"\/&gt;\r\n\t&lt;input type=\"text\" name=\"Foo\" value=\"Bar\"\/&gt;\r\n\t&lt;input type=\"submit\"&gt;\r\n&lt;\/form&gt;<\/pre>\n<h3>\u00a0\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u53d6\u5f97:<\/h3>\n<pre class=\"lang:default decode:true\">debug($this-&gt;request-&gt;data);<\/pre>\n<pre class=\"lang:default decode:true\">array(\r\n\t'Hoge' =&gt; 'Moge',\r\n\t'Foo' =&gt; 'Bar'\r\n)<\/pre>\n<hr \/>\n<p>&nbsp;<\/p>\n<h2>\u25a0Get\u3057\u305f\u5834\u5408<\/h2>\n<h3>\u30a2\u30af\u30bb\u30b9URL:<\/h3>\n<pre class=\"lang:default decode:true\">\/request_test\/index?hoge=moge&amp;foo=bar<\/pre>\n<h3>\u00a0\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u53d6\u5f97\uff1a<\/h3>\n<pre class=\"lang:php decode:true\">debug($this-&gt;request-&gt;query);<\/pre>\n<pre class=\"lang:default decode:true\">array(\r\n\t'hoge' =&gt; 'moge',\r\n\t'foo' =&gt; 'bar'\r\n)<\/pre>\n<hr \/>\n<p>&nbsp;<\/p>\n<h2>\u25a0URL\u306e\u5f8c\u308d\u306b\u30b9\u30e9\u30c3\u30b7\u30e5(\/)\u3067\u3072\u3063\u3064\u3051\u305f\u5834\u5408<\/h2>\n<h3>\u30a2\u30af\u30bb\u30b9URL:<\/h3>\n<pre class=\"lang:default decode:true\">\/request_test\/index\/hoge\/moge\/foo\/bar<\/pre>\n<h3>\u00a0\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u53d6\u5f97\uff1a<\/h3>\n<pre class=\"lang:php decode:true\">debug($this-&gt;request-&gt;pass);<\/pre>\n<pre class=\"lang:default decode:true\">array(\r\n\t(int) 0 =&gt; 'hoge',\r\n\t(int) 1 =&gt; 'moge',\r\n\t(int) 2 =&gt; 'foo',\r\n\t(int) 3 =&gt; 'bar'\r\n)<\/pre>\n<hr \/>\n<p>&nbsp;<\/p>\n<h2>\u25a0 URL\u306b\u540d\u524d\u4ed8\u304d\u5f15\u6570\u3067\u6e21\u3057\u305f\u5834\u5408<\/h2>\n<h3>\u30a2\u30af\u30bb\u30b9URL:<\/h3>\n<pre class=\"lang:default decode:true\">\/request_test\/index\/hoge:moge\/foo:bar<\/pre>\n<h3>\u00a0\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u53d6\u5f97\uff1a<\/h3>\n<pre class=\"lang:default decode:true\">debug($this-&gt;request-&gt;named);<\/pre>\n<pre class=\"lang:default decode:true\">array(\r\n\t'hoge' =&gt; 'moge',\r\n\t'foo' =&gt; 'bar'\r\n)<\/pre>\n<p>\u3061\u306a\u307f\u306b\u3001 named\u3084path\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u914d\u5217\u540d\u3067\u30a2\u30af\u30bb\u30b9\u3082\u3067\u304d\u308b\u3002<\/p>\n<pre class=\"lang:php decode:true\">debug($this-&gt;request['named']);\r\ndebug($this-&gt;request-&gt;params['named']);<\/pre>\n<p>\u304c\u3001\u500b\u4eba\u7684\u306b\u306f\u914d\u5217\u540d\u3067\u306e\u30a2\u30af\u30bb\u30b9\u306f\u4f7f\u308f\u306a\u3044\u304b\u306a\u30fb\u30fb\u3002<\/p>\n<hr \/>\n<p>&nbsp;<\/p>\n<h2>\u25a0HTTP\u30ea\u30af\u30a8\u30b9\u30c8\u306eBody\u306b\u4f55\u304b\u66f8\u304d\u8fbc\u307e\u308c\u3066\u3044\u308b\u5834\u5408<\/h2>\n<h3>\u30a2\u30af\u30bb\u30b9HTML:<\/h3>\n<p>Post\u3068\u540c\u3058HTML\u3068\u3059\u308b\u3002<\/p>\n<h3>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u53d6\u5f97\uff1a<\/h3>\n<pre class=\"lang:default decode:true\">debug($this-&gt;request-&gt;input());<\/pre>\n<pre class=\"lang:default decode:true\">'Hoge=Moge&amp;Foo=Bar'<\/pre>\n<p>\u3053\u306e\u4f8b\u3067\u306f\u3001Post\u306eBody\u3092\u898b\u3066\u3044\u308b\u3060\u3051\u3060\u304c\u3001REST\u7b49\u3067body\u306bJSON\u304c\u66f8\u304b\u308c\u3066\u3044\u308b\u5834\u5408\u306f\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306b\u53d7\u3051\u53d6\u308c\u308b<\/p>\n<pre class=\"lang:php decode:true\">$this-&gt;request-&gt;input('json_decode');\r\n<\/pre>\n<hr \/>\n<p>&nbsp;<\/p>\n<h2>\u25a0\u7d44\u307f\u5408\u308f\u305b<\/h2>\n<p>\u3061\u306a\u307f\u306b\u3001\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u3082\u3067\u304d\u308b\u3002<\/p>\n<h3>\u30a2\u30af\u30bb\u30b9HTML:<\/h3>\n<pre class=\"lang:xhtml decode:true\">&lt;form action=\"\/request_test\/index\/hoge:moge\/foo\/bar?hello=world\" method=\"POST\"&gt;\r\n\t&lt;input type=\"text\" name=\"Hoge\" value=\"Moge\"\/&gt;\r\n\t&lt;input type=\"text\" name=\"Foo\" value=\"Bar\"\/&gt;\r\n\t&lt;input type=\"submit\"&gt;\r\n&lt;\/form&gt;<\/pre>\n<p>\u3053\u306e\u5834\u5408\u3001path\u3082query\u3082named\u3082data\u3082\u53d6\u308c\u308b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>CakePHP2\u3067\u6295\u3052\u3089\u308c\u308b\u30c7\u30fc\u30bf\u306e\u53d7\u3051\u53d6\u308a\u65b9\u306f\u4f55\u7a2e\u985e\u304b\u3042\u308b\u3002 \u4f8b\u3068\u3057\u3066\u4f7f\u7528\u3057\u3066\u3044\u308b\u53d7\u3051\u53d6\u308a\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u7269\u3068\u3059\u308b\u3002 class RequestTestController extends AppContr&hellip;  <a href=\"https:\/\/gomokulog.gomocool.net\/?p=594\" class=\"more-link\">more <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[68],"tags":[],"class_list":["post-594","post","type-post","status-publish","format-standard","hentry","category-cakephp"],"_links":{"self":[{"href":"https:\/\/gomokulog.gomocool.net\/index.php?rest_route=\/wp\/v2\/posts\/594","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gomokulog.gomocool.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gomokulog.gomocool.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gomokulog.gomocool.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gomokulog.gomocool.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=594"}],"version-history":[{"count":6,"href":"https:\/\/gomokulog.gomocool.net\/index.php?rest_route=\/wp\/v2\/posts\/594\/revisions"}],"predecessor-version":[{"id":600,"href":"https:\/\/gomokulog.gomocool.net\/index.php?rest_route=\/wp\/v2\/posts\/594\/revisions\/600"}],"wp:attachment":[{"href":"https:\/\/gomokulog.gomocool.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=594"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gomokulog.gomocool.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=594"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gomokulog.gomocool.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=594"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}