WooCommerceなしでも導入できる!Stripe+WordPressで手軽に決済機能を導入する方法

E1ab278e65a01d6cd55385de579a9ad1?s=47 crebow
October 26, 2018

 WooCommerceなしでも導入できる!Stripe+WordPressで手軽に決済機能を導入する方法

「JP_Stripes (Stripe ユーザーグループ)in 広島 Vol.3 」にて発表したスライドです。
1.決済機能を実装する場合の選択肢とプラグイン
2.StripeCheckoutの実装について
3.Crebow Stripe JP Paymentプラグインを利用したチケット販売サイトの作成例の紹介と解説

E1ab278e65a01d6cd55385de579a9ad1?s=128

crebow

October 26, 2018
Tweet

Transcript

  1. 7.
  2. 17.

    & ࠃ಺ ࢿۚҠಈۀऀؔ౦ࡒ຿ہ௕ୈ߸ 1BZNFOU1SPDFTTPS 1BZNFOU1SPDFTTPS 1BZNFOUHBUFXBZ 1BZNFOU1SPDFTTPSɿখചళ΍ফඅऀ͔Β௚઀ࢧ෷͍৘ ใΛड͚औΓۜߦ΍ΫϨδοτΧʔυձࣾͷγεςϜʹ௚ ઀ΞΫηεͯ͠ॲཧΛߦ͏͜ͱ͕Ͱ͖Δ ࣄۀܗଶ

    ܾࡁख਺ྉ ສԁҎԼ ສԁ௒ສԁҎԼ ສԁ௒ ສԁҎԼ  ສԁ௒  ԁ݅  ԁ݅  ԁ݅  ԁ݅ ܾࡁ੒ཱ͝ͱ  ➤ ॳظඅ༻͸ແྉɺֹ݄අ·ͨ͸ӅΕͨख਺ྉ͸ Ұ੾ͳ͠ ➤ ࢖ͬͨ෼͚ͩͷख਺ྉ ➤ ϦΞϧλΠϜͷख਺ྉϨϙʔτ ͱ ͷൺֱ ➤ ւ֎͸ख਺ྉ͕มΘΓ·͢ɻ গֹܾࡁ ➤ ݄ؒച্͕ສԁΛ௒͑Δͱ͓τΫʹͳΔϚʔ νϟϯτϨʔτͷద༻ʹ͸ਃ੥͕ඞཁͰ͢ɻ ➤ ւ֎͸ख਺ྉ͕มΘΓ·͢ɻ ➤ গֹܾࡁΛ͝ར༻͍ͨͩ͘ʹ͸ਃ੥͕ඞཁͰ͢ɻ ճͷऔҾֹ͕ࠃ಺औҾ ԁҎԼ ʴԁ
  3. 18.

    & ৚݅෇͖ແྉ ۜߦޱ࠲΁ ͷҾ͖ग़͠ ➤ ࢒ߴΛۜߦޱ࠲΁Ҿ͖ग़ֹ͕ۚ͢ສԁະຬͷ ৔߹ԁ݅ͷख਺ྉ͕͔͔Γ·͢ɻ ➤ ۚ༥ػؔʹΑΓผ్ख਺ྉ͕͔͔Δ৔߹͕͋Γɺ ࣗ਎Ͱར༻͢Δۚ༥ػؔʹ͓໰͍߹ΘΔඞཁ͕

    ͋Γ·͢ɺ Ҿ͖ग़͠ʹ ཁ͢Δظؒ ग़ۚਃ੥͔ΒʙӦۀ೔ ➤ ۚ༥ػؔʹΑΓҟͳΓ·͢ ि·ͨ͸݄୯Ґͷબ୒ͷࣗಈৼࠐ ར༻Մೳ Χʔυ 7*4".BTUFS+$#  ".&9%JOFST "MJQBZ8F$IBU1BZ "QQMF1BZ(PPHMF1BZ 7*4".BTUFS+$# ".&9%JOFST࿆ۜ +$#͸ผ్ਃ੥͕ඞཁ 7*4".BTUFS+$# ࢧ෷͍ऀ΋ΞΧ΢ϯτొ࿥͕ඞཁɻϝʔϧͰͷܾࡁ੥ ٻ͸ΞΧ΢ϯτొ࿥ෆཁͰܾࡁՄೳɻ ΞΧ΢ϯτొ࿥ෆཁͰܾࡁՄೳ ֹ݄ར༻ྉ ԁ͕͔͔Γ·͢ ΢ΣϒϖΠϝϯτϓϥεΛར༻ͨ͠৔߹ ແྉ
  4. 19.

    Λબ୒͠·ͨ͠ & ͔ΜͨΜܾࡁϘλϯ )5.-  8PSE1SFTTϓϥάΠϯ༗Γ 1BZ1BMNFΛ࢖͏ख΋͋Δ ಋೖͷ͠΍͢͞ ʢ"1*ͷ஌ࣝͳ͠ʣ 8PSE1SFTTϓϥάΠϯ༗Γ

    ςΫχΧϧ αϙʔτ ಋೖͷ͠΍͢͞ ʢ"1*ͷ஌ࣝ͋Γʣ υΩϡϝϯτͷ ॆ࣮౓ º ˕ º ˕ ˚ ˕ ࣮૷·Ͱʹ ͔͔Δ৹ࠪ࣌ؒ 1BZ1BM࣍ୈ ଈ೔ ໰୊͕ൃ֮ͨ࣌͠఺Ͱࣄޙௐࠪ͋Γ ࢲͷ৔߹
  5. 25.

    & 4USJQF1BZNFOUTͷಛ௕ σδλϧ঎඼ʢϑΝΠϧɺԻָɺϏ σΦɺిࢠॻ੶ɺ1%'ͳͲʣΛൢച ͢Δ͜ͱ͕Ͱ͖·͢ɻߪೖ͕׬ྃ͠ ͨΒɺϢʔβʔ͸ࣗಈతʹσδλϧ ϑΝΠϧΛμ΢ϯϩʔυͰ͖·͢ɻ ΧʔτϓϥάΠϯ΍γϣοϐϯάܥ ͷϓϥάΠϯΛೖΕͳͯ͘΋ࢧ෷͍ ػೳ͕ಋೖɻ


    ੥ٻઌॅॴͷऩूΛ༗ޮʹ͢ΔΦϓ γϣϯ͕͋Γ·͢ɻ د෇ϘλϯΛ࡞੒͢Δ͜ͱ͕Ͱ͖· ͢ɻΧελϜՁ֨ΛೖྗͰ͖ΔΑ͏ ʹ͢ΔΦϓγϣϯ͕͋Γ·͢ɻ σδλϧϝσΟΞͷൢച ෺ൢʹ΋ར༻Մ د෇ػೳʢ౤͛મػೳʣ ͢΂ͯͷτϥϯβΫγϣϯ͸ɺϓϥ άΠϯͷ஫จϝχϡʔʹอଘ͞Ε· ͢ɻ8PSE1SFTT؅ཧμογϡϘʔυ Ͱߪೖ಺༰ΛݟΔ͜ͱ͕Ͱ͖·͢ɻ ड஫؅ཧ ސ٬ऩू ੡඼͝ͱʹαϯΩϡʔϖʔδ ྖऩॻΛૹΔ ϘλϯςΩετͷΧελϚΠζ 4USJQF͔Βސ٬ʹྖऩॻΛࣗಈతʹૹ৴͢ΔΦϓγϣϯ ߪೖϘλϯͷςΩετมߋ ੡඼͝ͱʹ࡞੒Մೳ νΣοΫΞ΢τϑΥʔϜʹͯऩू
  6. 26.

    & ఆظߪಡͱఆظࢧ෷͍Λઃఆͯ͠ ސ٬ʹൢച͢Δ͜ͱ͕Ͱ͖·͢ɻ 4VCTDSJQUJPO1BZNFOUT  "QQMFͱ(PPHMF1BZΛ࢖༻ͯ͠ ސ٬͔Βͷࢧ෷͍Λड͚ೖΕΔ͜ ͱ͕Ͱ͖·͢ɻ "QQMFBOE(PPHMF1BZ 

    ΢ΣϒαΠτ্ͷ"MJQBZܦ༝Ͱࢧ ෷͍Λड͚ೖΕΔ͜ͱ͕Ͱ͖·͢ɻ "MJQBZ"EEPO GSFF ෳ਺௨՟ͷΞυΦϯʹΑΓɺސ٬ ͸௨՟Λબ୒͠ɺͦͷ௨՟Ͱ঎඼ Λࢧ෷͏͜ͱ͕Ͱ͖·͢ɻ .VMUJ$VSSFODZ"EEPO  ސ٬ʹൢച͞Εͨσδλϧ੡඼͸ɺ ࣗಈతʹظݶ੾ΕʹͳΔ҉߸Խ͞ Εͨμ΢ϯϩʔυϦϯΫʹΑͬͯ อޢ͞Ε·͢ɻ 4FDVSF%PXOMPBET  4USJQF1BZNFOUT1MVHJOʹΑͬ ͯදࣔ͞ΕΔଟ͘ͷڞ௨ϝοηʔ δΛΧελϚΠζͰ͖·͢ɻ $VTUPN.FTTBHFT"EEPO  ΞϑΟϦΤΠτϓϥάΠϯ͸ɺΞ ΠςϜΛߪೖ͢Δސ٬Λ௥੻͠঺ հऀʹద੾ͳख਺ྉΛत༩͠·͢ɻ 81"GGJMJBUF*OUFHSBUJPO GSFF ސ٬͕ετϥΠϓࢧ෷͍ϘλϯΛ ΫϦοΫ͢ΔͱSF$"15$)"ϙο ϓΞοϓ͕දࣔ͞Ε·͢ɻ SF$"15$)""EEPO GSFF 4USJQF1BZNFOUTͷಛ௕ʲ"EEPOTʳ
  7. 29.

    & $SFCPX4USJQF+11BZNFOUͷಛ௕ ঎༻ɾඇ঎༻໰Θͣࣗ༝ʹ͝ར༻͍ ͚ͨͩΔ͚ͩͰͳ͘ɺίʔυͷվม ͯ͠࠶ར༻͢Δ͜ͱ͕Ͱ͖·͢ɻ ঎༻ɾඇ঎༻໰Θͣࣗ༝ʹ͝ར༻͍ ͚ͨͩΔ͚ͩͰͳ͘ɺίʔυͷվม ͯ͠࠶ར༻͢Δ͜ͱ͕Ͱ͖·͢ɻ ΧʔτϓϥάΠϯ΍γϣοϐϯάܥ ͷϓϥάΠϯΛೖΕͳͯ͘΋ࢧ෷͍

    ػೳ͕ಋೖ ແྉͰར༻Մೳ ೔ຊਓ޲͚ʹղઆ ෺ൢʹ΋ར༻Մ هࣄʢΞΠςϜʣ͝ͱʹӾཡ੍ݶ͕ Ͱ͖ΔͨΊɺձһ੍αΠτͳͲʹ׆ ༻Ͱ͖·͢ɻ ༗ྉίϯςϯπ഑৴ ঎༻ɾඇ঎༻໰Θͣࣗ༝ʹ͝ར༻͍ ͚ͨͩΔ͚ͩͰͳ͘ɺίʔυͷվม ͯ͠࠶ར༻͢Δ͜ͱ͕Ͱ͖·͢ɻ ࡏݿ؅ཧ ঎༻ɾඇ঎༻໰Θͣࣗ༝ʹ͝ར༻͍ ͚ͨͩΔ͚ͩͰͳ͘ɺίʔυͷվม ͯ͠࠶ར༻͢Δ͜ͱ͕Ͱ͖·͢ɻ ߪೖऀ؅ཧ ઃஔ΍ΧελϚΠζ͕೉͍͠ํʹ͸ νϟοτπʔϧʮTMBDLʯΛར༻͠ ͯಋೖαϙʔτʢ༗ঈʣΛߦ͍·͢ɻ ·݄ͨʑͷӡ༻αϙʔτʢ༗ঈʣ΋ ʹͯରԠ͍ͨ͠·͢ɻ ಋೖαϙʔτ ϓϥάΠϯΛར༻ͨ͠αΠτߏஙͷ ͓ख఻͍΋͍͖ͤͯͨͩ͞·͢ʂ ϑϧΧελϚΠζ (1-ϥΠ ηϯε 8FCIPPL 8FCIPPL 8FCIPPL /&8 /&8
  8. 30.

    & σδλϧϝσΟΞ ͷൢച ˓ ˓ γεςϜ 4USJQF$IFDLPVU 4USJQF$IFDLPVU ຒΊࠐΈํ๏ γϣʔτίʔυ

    γϣʔτίʔυ ෺ൢར༻ ˓ ˓ ΧελϜֹۚ ˓ ೔ຊޠରԠ - - ೔ຊޠӳޠ ௨՟ ೔ຊԁͷΈ ଞ௨՟ରԠ ϘλϯςΩετ ΧελϜՄ ΧελϜՄ ෳ਺ߪೖ ˓ ˓ ݸผʹରԠʢ༗ྉʣ μ΢ϯϩʔυ 8PSEQSFTTެࣜ (JU)VC 8PSE1SFTTެࣜ΁͸ਃ੥༧ఆ ސ٬؅ཧ ࡏݿ؅ཧ 4USJQF͔Βސ٬ʹ ྖऩॻΛૹΔ 4USJQFʹ Χʔυ৘ใΛอଘ data-allow-remember-me #*--*/(ͷར༻ ʢαϒεΫϦϓγϣϯʣ "QQMF1BZ (PPHMF1BZ ௨஌ϝʔϧ "EEPO<༗ྉ> "EEPO<༗ྉ> "EEPO<༗ྉ> "EEPO<ແྉ> ։ൃத ະఆ ະఆ ະఆ ରԠ༧ఆͳ͠ ݸผରԠʢ༗ྉʣ ˓ ˓ ˓ ˓ ˓ ˓ ˓ ˓ Λൺֱͯ͠Έͨ ͱ
  9. 40.

    & 4USJQF1)1CJOEJOHTΛར༻͢Δ <?php require_once( dirname(__FILE__).'/stripe-php-6.16.0/init.php'); \Stripe\Stripe::setApiKey('secretkeyxxxxxxxxxxxxxxxxxxxxxxxx'); $token = $_POST[ 'stripeToken'

    ]; $email = $_POST[ 'stripeEmail' ]; $amount = $_POST[ 'amount' ]; $description = $_POST[ 'description' ]; $currency = $_POST[ 'currency' ]; try { $charge = \Stripe\Charge::create(array( 'amount' => $amount, 'currency' => $currency, 'source' => $token, 'description' => $description, 'receipt_email' => $email, )); }ɾɾɾɾɾɾ SFRVJSF@PODFͰJOJUQIQΛಡΈࠐΉ
  10. 43.

    & DIFDLPVUKTͷهड़ྫ <form action = "xxxxxxxxxxxxxxxxxx" method = “POST"> <script

    src = "https://checkout.stripe.com/checkout.js" class = "stripe-button" data-key = "pk_test_xxxxxxxxxxxxxxxxxxxxx" data-amount = "800" data-name = "ൢചݩ໊" data-description = "঎඼໊" data-image = "https://xxxxxxxxxxx/xxxxxxxxxx.png" data-locale = "auto" data-currency = "jpy" data-zip-code = "false" data-allow-remember-me = "false" data-label = "ࠓ͙͢ߪೖ "> </script> </form>
  11. 44.

    & طଘͷύϥϝʔλ EBUBLFZ EBUBBNPVOU EBUBOBNF EBUBEFTDSJQUJPO EBUBJNBHF EBUBMPDBMF EBUBDVSSFODZ EBUBBMMPXSFNFNCFSNF

    EBUBMBCFM 1VCMJTIBCMF,FZΛهड़͠·͢ɻඞਢ߲໨Ͱ͢ ܾࡁֹ͍ͤͨۚ͞Λೖྗ͠·͢ɻ γϣοϓ໊΍αΠτ໊Λೖྗ͠·͢ɻ EBUBOBNFͷԼʹදࣔͤ͞Δઆ໌จɻࣈʙࣈఔ౓ ϑΥʔϜͷ্෦ʹදࣔ͞ΕΔΞΠίϯը૾ͷ63-Λೖྗ͢Δ ࢖༻͢Δݴޠ ࢖༻͢Δ௨՟୯Ґͷઃఆ ܾࡁ৘ใͷอଘػೳʢ஫ɿ4USJQFʹอଘ͞Ε·͕͢؅ཧऀ͕؅ཧͰ͖ΔΘ͚Ͱ͸ͳ͍ʣ Ϙλϯͷ໊લ
  12. 45.

    & ΍Γ͍ͨ͜ͱ ܾࡁ׬ྃ 8FCIPPL 8&# αʔόʔ %# αʔόʔ "KBY ߪೖը໘

    σʔλͷॲཧ ܾࡁޙͷը໘ ಠࣗͷύϥϝʔλΛૹͬͯಈ࡞Λ੍ޚ͍ͨ͠ ঎඼ͷ*%΍঎඼ίʔυϢʔβʔ*%ͳͲಠࣗͷύϥϝʔλ
  13. 46.

    & ಠࣗύϥϝʔλ͸JOQVUUZQFIJEEFOͰରԠ <input type="hidden" name="amount" value="xxxxx"> <input type="hidden" name="description" value="xxxxx">

    <input type="hidden" name="currency" value="xxxxx"> <input type="hidden" name="userid" value="xxxxx"> <input type="hidden" name="itemname" value="xxxxx"> <input type="hidden" name="daytime" value="xxxxx"> <input type="hidden" name="itemmpostid" value="xxxxx"> <input type="hidden" name="stockuse" value="xxxxx"> <input type="hidden" name="stockcount" value="xxxxx"> <input type="hidden" name="productcode" value=“xxxxx"> </form> ಠࣗύϥϝʔλ͸DIFDLPVUKTͷதʹ͸ؚΊͳ͍
  14. 47.

    & 4USJQFʹσʔλʹಠࣗύϥϝʔλΛૹΕΔΑ͏ʹ͢Δ $metadata = array( 'userid' => $_POST[ 'userid' ],

    'daytime' => $_POST[ 'daytime' ], 'itemname' => $_POST[ 'itemname' ], 'productcode' => $_POST[ 'productcode' ], 'itemmpostid' => $_POST[ 'itemmpostid' ], 'stockuse' => $_POST[ 'stockuse' ], 'stockcount' => $_POST[ 'stockcount' ], ); ૹΔલʹσʔλΛ഑ྻʹ͢Δ try { $charge = \Stripe\Charge::create(array( 'amount' => $amount, 'currency' => $currency, 'source' => $token, 'description' => $description, 'receipt_email' => $email, 'metadata' => $metadata, )); }ɾɾɾɾɾɾ NFUBEBUBͱͯ͠ૹΔ
  15. 48.

    & XFCIPPLͰಠࣗύϥϝʔλΛड͚औΕΔΑ͏ʹ͢Δ $webhook_stripeid = $json->data->object->id; $webhook_userid = $json->data->object->metadata->userid; $webhook_itemname =

    $json->data->object->metadata->itemname; $webhook_user = $json->data->object->source->name; $webhook_receipt_email = $json->data->object->receipt_email; $webhook_productcode = $json->data->object->metadata->productcode; $webhook_daytime = $json->data->object->metadata->daytime; $webhook_amount = $json->data->object->amount; $webhook_status = $json->data->object->status; //ࡏݿ؅ཧ $webhook_itemmpostid = $json->data->object->metadata->itemmpostid; $webhook_stockuse = $json->data->object->metadata->stockuse; $webhook_stockcount = $json->data->object->metadata->stockcount; GJMF@HFU@DPOUFOUT QIQJOQVU Ͱ+40/ຊจͷCPEZΛड͚औͬͯ KTPO@EFDPEFؔ਺ͰจࣈྻΛ഑ྻʹมߋ
  16. 54.

    & ߏஙલʹܾΊ͓ͯ͘͜ͱ ձ৔Ͱͷνέοτ֬ೝͷํ๏ʹ͍ͭͯ ໨ࢹͰ֬ೝ νέοτͷߪೖ੍ݶ ਓຕݶΓ ਓຕͷఆٛ͸ʁਓ͸Ϣʔβʔʁ ؅ཧػೳ͕ඞཁ ߪಡऀొ࿥ͤͯ͞Ϣʔβʔͷ؅ཧ͢Δඞཁ͕͋Δ ౎౓ߪೖ

    طଘͷػೳͰ0, ෳ਺ߪೖ ෳ਺ߪೖͰ͖ΔΑ͏ͳ࢓૊Έ͕ඞཁ ϝʔϧ΍ྖऩॻΛর߹͢Δ࡞ۀ͕ඞཁ 23ͳͲΛൃߦͯ֬͠ೝ ؅ཧػೳ͕ඞཁ $384+1Ͱ͸ߪೖͨ͠Ϣʔβʔ͚ͩʹίϯςϯπΛදࣔͤ͞Δػೳ͋Γ
  17. 57.

    & " ૉਓ͕ೖྗ͢Δ͜ͱΛ૝ఆ͓ͯ͘͠ ࢓༷͕มΘͬͨࡍɺαΠτ͕දࣔ͞Εͳ͍౳ͷෆ۩߹Λ ճආͰ͖Δઃܭʹ͓ͯ͘͠ αΠτ؅ཧऀ ɾ)5.-ͳͲͷ஌ࣝ͸๡ͯ͘͠΋࢖͑ΔΑ͏ʹ͓ͯ͘͠ ੍࡞ձࣾ ϓϥάΠϯʹ͸खΛೖΕͣ ͦͷ··࢖༻͢Δ

    ΧελϜϑΟʔϧυͳͲϓ ϥάΠϯԽͯ͠࢖༻͢Δ Ξοϓσʔτ͖ΔΑ͏ʹ͓ͯ͘͠ ௥Ճػೳ͸ෆ۩߹͕ग़ͨࡍɺϓϥάΠϯΛఀ ࢭ͢Δ͚ͩͰɺαΠτશମΛࢭΊͳ͍࢓૊Έ ʹ͓ͯ͘͠ ؅ཧը໘ μογϡϘʔυ Ͱ ௥Ճͨ͠ػೳΛ࢖͑ΔΑ͏ʹ͢Δ
  18. 59.

    & ·ͱΊ 4USJQF$IFDLPVUͷ࣮૷ʹ͍ͭͯͷ εςʔλε TUBOECZ TBMF QBVTF FOE TPMEPVU ελϯόΠ

    ൃചத ൃചٳࢭ ൃചऴྃ ചΓ੾Ε νέοτ໊ νέοτ໊ TJOHMF NVMUJQMF ຕߪೖ ෳ਺ߪೖ UJDLFU@TUBUVT UJDLFU@TUSJQF@JE UJDLFU@UZQF ։࠵೔ UJDLFU@EBZ ։৔࣌ؒ UJDLFU@PQFO ։ԋ࣌ؒ UJDLFU@TUBSU લചνέοτֹۚ UJDLFU@BEWBODF@TBMF ౰೔νέοτֹۚ UJDLFU@UIBUEBZ XQ@FORVFVF@TDSJQU KRVFSZVJDPSF  XQ@FORVFVF@TDSJQU KRVFSZVJEBUFQJDLFS  XQ@FORVFVF@TUZMF KRVFSZVJDTT BKBYHPPHMFBQJTDPNBKBYMJCTKRVFSZVJUIFNFTTNPPUIOFTTKRVFSZVJDTT  XQ@FORVFVF@TDSJQU KRVFSZVJKTKB BKBYHPPHMFBQJTDPNBKBYMJCTKRVFSZVJJOKRVFSZVJEBUFQJDLFSKBNJOKT  ։࠵೔͸K2VFSZ6*%BUFQJDLFS
  19. 60.

    & ·ͱΊ 4USJQF$IFDLPVUͷ࣮૷ʹ͍ͭͯͷ QPTU@TUBUVT͕QVCMJTIɺQPTU@UZQF͕DSXTKQ@TUSJQF@JUFNͷσʔλΛऔಘ͠·͢ $query_ITEM = <<<SQL SELECT * FROM

    {$wpdb->posts} WHERE post_status = 'publish' AND post_type = 'crwsjp_stripe_item' SQL; $results_ITEM = $wpdb->get_results($query_ITEM); get_results ʹ͍ͭͯɹhttps://wpdocs.osdn.jp/ؔ਺ϦϑΝϨϯε/wpdb_Classࢀর $4+1ϓϥάΠϯͰอଘ͍ͯ͠ΔσʔλΛऔಘ͢Δ $4+1ϓϥάΠϯͰ͸ΧελϜ౤ߘλΠϓΛར༻ͯ͠σʔλΛอଘ͍ͯ͠·͢ɻ ֤छઃఆ৘ใ͸XQ@PQUJPOTʹอଘ͍ͯ͠·͢ɻ ͜ΕΒͷσʔλΛ͏·͘ར༻͢Ε͹ɺػೳΛͲΜͲΜ֦ு͢Δ͜ͱ͕Ͱ͖·͢ɻ
  20. 61.

    & ·ͱΊ 4USJQF$IFDLPVUͷ࣮૷ʹ͍ͭͯͷ foreach($results_ITEM as $for_id){ $postid = $for_id ->

    ID; $valueid = $for_id -> ID; if(!isset($results_ITEM_id)){ $results_ITEM_id = array( $postid => $valueid ); }else{ $results_ITEM_id += array( $postid => $valueid ); } }
  21. 62.

    & ·ͱΊ 4USJQF$IFDLPVUͷ࣮૷ʹ͍ͭͯͷ foreach($results_ITEM as $for_title){ $post_title = $for_title ->

    ID; $value_title = $for_title -> post_title; if(!isset($results_ITEM_title)){ $results_ITEM_title = array( $post_title => $value_title ); }else{ $results_ITEM_title += array( $post_title => $value_title ); } }