{"id":8244,"date":"2020-01-16T10:00:36","date_gmt":"2020-01-16T01:00:36","guid":{"rendered":"https:\/\/www.gigas-jp.com\/appnews\/?p=8244"},"modified":"2020-01-15T22:49:39","modified_gmt":"2020-01-15T13:49:39","slug":"cakephp-%e3%83%95%e3%82%a9%e3%83%bc%e3%83%a0%e3%83%98%e3%83%ab%e3%83%91%e3%83%bc2","status":"publish","type":"post","link":"https:\/\/www.gigas-jp.com\/appnews\/archives\/8244","title":{"rendered":"CakePHP \u30d5\u30a9\u30fc\u30e0\u30d8\u30eb\u30d1\u30fc(2)"},"content":{"rendered":"\n<p>\u672c\u8a18\u4e8b\u306f\u524d\u56de\u306e\u300c<a href=\"\/appnews\/archives\/8189\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"CakePHP \u30d5\u30a9\u30fc\u30e0\u30d8\u30eb\u30d1\u30fc(1) (\u65b0\u3057\u3044\u30bf\u30d6\u3067\u958b\u304f)\">CakePHP \u30d5\u30a9\u30fc\u30e0\u30d8\u30eb\u30d1\u30fc(1)<\/a>\u300d\u306e\u7d9a\u304d\u3067\u3059\u3002<br> \u524d\u56de\u306fCakePHP\u306e\u300c\u30d5\u30a9\u30fc\u30e0\u30d8\u30eb\u30d1\u30fc\u300d\u3068\u3044\u3046\u6a5f\u80fd\u3092\u4f7f\u7528\u3057\u3066\u3001\u5165\u529b\u30d5\u30a9\u30fc\u30e0\u7528\u306eHTML\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002<br> \u4eca\u56de\u306f\u305d\u306e\u30d5\u30a9\u30fc\u30e0\u3092\u4f7f\u7528\u3057\u3066\u9001\u4fe1(Submit)\u3055\u308c\u305f\u5024\u3092\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u5074\u3067\u53d7\u3051\u53d6\u308b\u65b9\u6cd5\u3092\u8aac\u660e\u3044\u305f\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<!--more-->\n\n\n\n<h4>Chrome\u30c7\u30d9\u30ed\u30c3\u30d1\u30fc\u30c4\u30fc\u30eb\u3067\u306e\u78ba\u8a8d<\/h4>\n\n\n\n<p>Chrome\u30c7\u30d9\u30ed\u30c3\u30d1\u30fc\u30c4\u30fc\u30eb\u3067\u5024\u304cPOST\u9001\u4fe1\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<br>\nChrome\u30d6\u30e9\u30a6\u30b6\u3067\u300cF12\u300d\u30dc\u30bf\u30f3\u3092\u62bc\u4e0b\u3057\u3066\u3001\u30c7\u30d9\u30ed\u30c3\u30d1\u30fc\u30c4\u30fc\u30eb\u3092\u8868\u793a\u3055\u305b\u3001\u300cNetwork\u300d\u30bf\u30d6\u3092\u958b\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p> <br>\u524d\u56de\u306e\u300c<a rel=\"noreferrer noopener\" href=\"\/appnews\/archives\/8189\" target=\"_blank\">CakePHP \u30d5\u30a9\u30fc\u30e0\u30d8\u30eb\u30d1\u30fc(1)<\/a>\u300d \u3067\u4f5c\u6210\u3057\u305f\u5165\u529b\u30d5\u30a9\u30fc\u30e0\u306b\u9069\u5f53\u306a\u5024\u3092\u5165\u529b\u3057\u3066\u300c\u9001\u4fe1\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068<br> \u4ee5\u4e0b\u306e\u3088\u3046\u306bHeaders\u30bf\u30d6\u306e\u300cForm Data\u300d\u6b04\u3067POST\u3055\u308c\u305f\u5024\u3092\u78ba\u8a8d\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" width=\"953\" height=\"807\" src=\"\/appnews\/wp-content\/uploads\/sites\/4\/2020\/01\/1.png\" alt=\"\" class=\"wp-image-8248\"\/><\/figure>\n\n\n\n<h4>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u5074\u3067\u306e\u5024\u306e\u53d7\u3051\u53d6\u308a<\/h4>\n\n\n\n<p>\u300c\u30d5\u30a9\u30fc\u30e0\u30d8\u30eb\u30d1\u30fc\u300d\u306b\u3088\u308b\u30d5\u30a9\u30fc\u30e0\u4f5c\u6210\u6642\u306b\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u8a18\u8ff0\u3067\u30d5\u30a9\u30fc\u30e0\u306e\u958b\u59cb\u30bf\u30b0\u306e\u751f\u6210\u3092\u304a\u3053\u306a\u3044\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?=$this->Form->create(null, ['url' => ['controller' => 'sample', 'action' => 'index'], 'type' => 'post'])?><\/code><\/pre>\n\n\n\n<p>\u4e0a\u8a18\u306e\u8a18\u8ff0\u306e\u7b2c2\u5f15\u6570\u3067\u3001\u9023\u643a\u3059\u308b\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3068\u30a2\u30af\u30b7\u30e7\u30f3\u30e1\u30bd\u30c3\u30c9\uff08\u300cSampleController\u300d\u306e\u300cindex\u300d\u30e1\u30bd\u30c3\u30c9\u3068\u9023\u643a\u3059\u308b\u3088\u3046\u306b\u8a18\u8ff0\u3057\u3066\u3044\u307e\u3059\uff09\u3001\u304a\u3088\u3073\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u9001\u4fe1\u65b9\u6cd5(&#8216;post&#8217;\uff09\u3092\u8a2d\u5b9a\u3057\u3066\u3044\u307e\u3059\u306e\u3067\u3001post\u3055\u308c\u305f\u30d1\u30e9\u30e1\u30fc\u30bf\u306f\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc(C:\\xampp\\htdocs\\caketest\\src\\Controller\\SampleController.php)\u5185\u306eindex\u30e1\u30bd\u30c3\u30c9\u3067\u53d7\u3051\u53d6\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p>SampleController.php\u3067post\u3055\u308c\u305f\u5024\u3092\u53d7\u3051\u53d6\u308b\u51e6\u7406\u3092\u8a18\u8ff0\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\nnamespace App\\Controller;\nuse App\\Controller\\AppController;\n\nclass SampleController extends AppController\n{\n\n\tpublic function index()\n\t{\n\t\t$this->viewBuilder()->autoLayout(false);\n\n\t\t\/\/post\u306e\u5834\u5408\u306e\u51e6\u7406\n\t\tif($this->request->isPost()){\n\t\t\t$this->set('postdata', $this->request->data['txt']);\n\t\t}else{\n\t\t\t$this->set('postdata',[]);\n\t\t}\n\t}\n\n}<\/code><\/pre>\n\n\n\n<p>\u4e0a\u8a18\u306e\u4f8b\u3067\u306fpost\u3055\u308c\u305f\u5834\u5408\u3001&#8217;txt'(\u30c6\u30ad\u30b9\u30c8\u30dc\u30c3\u30af\u30b9)\u306b\u5165\u529b\u3055\u308c\u305f\u5024\u3092\u53d6\u308a\u51fa\u3057\u3066\u3001&#8217;postdata&#8217;\u306b\u30bb\u30c3\u30c8\u3057\u3066\u3044\u307e\u3059\u3002<br>\n\u30da\u30fc\u30b8\u306e\u521d\u671f\u8868\u793a\u306e\u969b\u306f\u3001\u306a\u306b\u3082post\u3055\u308c\u306a\u3044\u306e\u3067\u3001\u305d\u306e\u5834\u5408\u306f\u7a7a\u306e\u914d\u5217\u3092&#8217;postdata&#8217;\u306b\u30bb\u30c3\u30c8\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3067\u53d7\u3051\u53d6\u3063\u305f\u5024(&#8216;postdata&#8217;)\u3092\u753b\u9762\u306b\u8868\u793a\u3055\u305b\u3066\u78ba\u8a8d\u3059\u308b\u305f\u3081\u306b\u3001index.ctp\u306b\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php var_dump($postdata);?><\/code><\/pre>\n\n\n\n<p>\u5b9f\u884c\u7d50\u679c\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" width=\"941\" height=\"803\" src=\"\/appnews\/wp-content\/uploads\/sites\/4\/2020\/01\/2.png\" alt=\"\" class=\"wp-image-8249\"\/><\/figure>\n\n\n\n<p>\u4ee5\u4e0a\u306e\u4f8b\u3067\u306f\u30c6\u30ad\u30b9\u30c8\u30dc\u30c3\u30af\u30b9\u306e\u5024\u306e\u307f\u3092\u53d6\u308a\u51fa\u3057\u307e\u3057\u305f\u304c\u3001\u30e9\u30b8\u30aa\u30dc\u30bf\u30f3\u3084\u30c1\u30a7\u30c3\u30af\u30dc\u30c3\u30af\u30b9\u306a\u3069\u306e\u5024\u3082\u540c\u69d8\u306b\u53d6\u308a\u51fa\u3059\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n\n\n\n<h4>\u30d5\u30a9\u30fc\u30e0\u5185\u306e\u5404\u8981\u7d20\u3092\u307e\u3068\u3081\u3066\u914d\u5217\u3068\u3057\u3066\u53d6\u308a\u51fa\u3059\u65b9\u6cd5<\/h4>\n\n\n\n<p>\u30d5\u30a9\u30fc\u30e0\u5185\u306e\u5404\u9805\u76ee\u3092\u3072\u3068\u3064\u305a\u3064\u53d6\u308a\u51fa\u3059\u304b\u308f\u308a\u306b\u4e00\u5ea6\u306b\u914d\u5217\u3068\u3057\u3066\u53d6\u308a\u51fa\u3059\u3053\u3068\u3082\u53ef\u80fd\u3067\u3059\u3002<br> index.ctp \u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u66f8\u304d\u63db\u3048\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\n&lt;?php var_dump($postdata);?>\n&lt;br>&lt;br>\n\n&lt;?=$this->Form->create(null, ['url' => ['controller' => 'sample', 'action' => 'index'], 'type' => 'post'])?>\n\n\u30c6\u30ad\u30b9\u30c8\u30dc\u30c3\u30af\u30b9&lt;br>\n&lt;?=$this->Form->text('Form1.txt');?>&lt;br>&lt;br>\n\n\u30c1\u30a7\u30c3\u30af\u30dc\u30c3\u30af\u30b9&lt;br>\n&lt;?=$this->Form->checkbox('Form1.chk1', ['id'=>'chk1']);?>\n&lt;?=$this->Form->label('chk1', '\u30c1\u30a7\u30c3\u30af1');?>\n&lt;?=$this->Form->checkbox('Form1.chk2', ['id'=>'chk2']);?>\n&lt;?=$this->Form->label('chk2', '\u30c1\u30a7\u30c3\u30af2');?>\n&lt;br>&lt;br>\n\n\u30e9\u30b8\u30aa\u30dc\u30bf\u30f3&lt;br>\n&lt;?=$this->Form->radio('Form1.radio',[\n    ['text'=>'\u30e9\u30b8\u30aaA', 'value'=>'radioA', 'checked'=>true],\n    ['text'=>'\u30e9\u30b8\u30aaB', 'value'=>'radioB']\n]);?>&lt;br>&lt;br>\n\n\u30bb\u30ec\u30af\u30c8\u30dc\u30c3\u30af\u30b9&lt;br>\n&lt;?=$this->Form->select('Form1.select', [\n    'sel1'=>'\u30bb\u30ec\u30af\u30c81', 'sel2'=>'\u30bb\u30ec\u30af\u30c82', 'sel3'=>'\u30bb\u30ec\u30af\u30c83'\n]);?>&lt;br>&lt;br>\n\n\u30bb\u30ec\u30af\u30c8\u30dc\u30c3\u30af\u30b9(\u8907\u6570\u9078\u629e)&lt;br>\n&lt;?=$this->Form->select('Form1.selectmulti', [\n    'sel1'=>'\u30bb\u30ec\u30af\u30c81', 'sel2'=>'\u30bb\u30ec\u30af\u30c82', 'sel3'=>'\u30bb\u30ec\u30af\u30c83'\n],[\n    'multiple'=>true,\n    'size'=>3\n]);?>&lt;br>&lt;br>\n\n\n&lt;?=$this->Form->submit('\u9001\u4fe1')?>\n&lt;?=$this->Form->end()?>\n<\/code><\/pre>\n\n\n\n<p>\u30d5\u30a9\u30fc\u30e0\u5185\u306e\u5404\u9805\u76ee\u306ename\u5c5e\u6027\u3092\u6307\u5b9a\u3059\u308b\u90e8\u5206\u306b\u300cForm1.\u300d\u3092\u8ffd\u52a0\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u3053\u306e\u3088\u3046\u306b\u8a18\u8ff0\u3059\u308b\u3068\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u3067\u5024\u3092\u53d6\u308a\u51fa\u3059\u969b\u306b\u3001\u4ee5\u4e0b\u306e\u8a18\u8ff0\u3067\u3001\u4e00\u5ea6\u306b\u30d5\u30a9\u30fc\u30e0\u5185\u306e\u5404\u9805\u76ee\u306e\u5024\u3092\u53d6\u308a\u51fa\u3059\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$this->request->data['Form1']<\/code><\/pre>\n\n\n\n<p>$postdata\u3092var_dump\u3067\u8868\u793a\u3055\u305b\u305f\u5b9f\u884c\u7d50\u679c\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" width=\"952\" height=\"806\" src=\"\/appnews\/wp-content\/uploads\/sites\/4\/2020\/01\/3.png\" alt=\"\" class=\"wp-image-8250\"\/><\/figure>\n\n\n\n<p>\u6b21\u56de\u306fCakePHP\u3067\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u9023\u643a\u65b9\u6cd5\u304a\u3088\u3073\u30c6\u30fc\u30d6\u30eb\u30af\u30e9\u30b9\u3068\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30af\u30e9\u30b9\u306e\u5404\u5f79\u5272\u306b\u3064\u3044\u3066\u306e\u8aac\u660e\u3092\u304a\u3053\u306a\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u6728\u66dc\u65e5\u62c5\u5f53\uff1anishida<\/p>\n<div class='wp_social_bookmarking_light'>\n            <div class=\"wsbl_google_plus_one\"><g:plusone size=\"medium\" annotation=\"none\" href=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/8244\" ><\/g:plusone><\/div>\n            <div class=\"wsbl_hatena_button\"><a href=\"\/\/b.hatena.ne.jp\/entry\/https:\/\/www.gigas-jp.com\/appnews\/archives\/8244\" class=\"hatena-bookmark-button\" data-hatena-bookmark-title=\"CakePHP \u30d5\u30a9\u30fc\u30e0\u30d8\u30eb\u30d1\u30fc(2)\" data-hatena-bookmark-layout=\"standard\" title=\"\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0\"> <img src=\"\/\/b.hatena.ne.jp\/images\/entry-button\/button-only@2x.png\" alt=\"\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0\" width=\"20\" height=\"20\" style=\"border: none;\" \/><\/a><script type=\"text\/javascript\" src=\"\/\/b.hatena.ne.jp\/js\/bookmark_button.js\" charset=\"utf-8\" async=\"async\"><\/script><\/div>\n            <div class=\"wsbl_twitter\"><a href=\"https:\/\/twitter.com\/share\" class=\"twitter-share-button\" data-url=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/8244\" data-text=\"CakePHP \u30d5\u30a9\u30fc\u30e0\u30d8\u30eb\u30d1\u30fc(2)\" data-via=\"GIGASJAPAN_APPS\" data-lang=\"ja\">Tweet<\/a><\/div>\n            <div class=\"wsbl_facebook_like\"><div id=\"fb-root\"><\/div><fb:like href=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/8244\" layout=\"button_count\" action=\"like\" width=\"100\" share=\"false\" show_faces=\"false\" ><\/fb:like><\/div>\n            <div class=\"wsbl_facebook_send\"><div id=\"fb-root\"><\/div><fb:send href=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/8244\" colorscheme=\"light\" ><\/fb:send><\/div>\n    <\/div>\n<br class='wp_social_bookmarking_light_clear' \/>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u8a18\u4e8b\u306f\u524d\u56de\u306e\u300cCakePHP \u30d5\u30a9\u30fc\u30e0\u30d8\u30eb\u30d1\u30fc(1)\u300d\u306e\u7d9a\u304d\u3067\u3059\u3002 \u524d\u56de\u306fCakePHP\u306e\u300c\u30d5\u30a9\u30fc\u30e0\u30d8\u30eb\u30d1\u30fc\u300d\u3068\u3044\u3046\u6a5f\u80fd\u3092\u4f7f\u7528\u3057\u3066\u3001\u5165\u529b\u30d5\u30a9\u30fc\u30e0\u7528\u306eHTML\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002 \u4eca\u56de\u306f\u305d\u306e\u30d5\u30a9\u30fc\u30e0\u3092\u4f7f\u7528\u3057\u3066\u9001\u4fe1(Submi [&hellip;]<\/p>\n","protected":false},"author":16,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[100],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/8244"}],"collection":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/comments?post=8244"}],"version-history":[{"count":6,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/8244\/revisions"}],"predecessor-version":[{"id":8254,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/8244\/revisions\/8254"}],"wp:attachment":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/media?parent=8244"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/categories?post=8244"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/tags?post=8244"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}