尊龙凯时人生就是博

ÔõÑùÔÚThinkPHP6ÖÐʹÓÃ΢ÐÅSDK£¿

Ëæ×Å΢ÐŵÄÊ¢ÐÐ £¬Ô½À´Ô½¶àµÄ¿ª·¢ÕßÐèÒªÔÚËûÃǵÄÓ¦ÓóÌÐòÖм¯³É΢ÐÅsdk¡£¶øÔÚthinkphp6ÖÐ £¬ÎÒÃÇ¿ÉÒÔºÜÈÝÒ×µØʵÏÖÕâһĿµÄ¡£±¾ÎĽ«ÏÈÈÝÔõÑùʹÓÃ΢ÐÅsdk¾ÙÐпª·¢ £¬Ïêϸ°üÀ¨ÒÔÏÂÄÚÈÝ£º

×°ÖÃ΢ÐÅSDK

ÉèÖÃ΢ÐÅSDK

·¢ËÍÇëÇó

»ñȡ΢ÐÅ·µ»ØЧ¹û

ʾÀý´úÂë

×°ÖÃ΢ÐÅSDK

ʹÓÃComposer×°ÖÃ΢ÐÅSDK £¬Ö»ÐèÒªÖ´ÐÐÏÂÃæµÄÏÂÁ

composer require overtrue/wechat

µÇ¼ºó¸´ÖÆ

ÉèÖÃ΢ÐÅSDK

ÔÚconfigĿ¼ÏÂн¨wechat.phpÎļþ £¬È»ºóÌí¼ÓÒÔÏ´úÂ룺

<?php

return [
    'app_id' => 'ÄãµÄAppID',
    'secret' => 'ÄãµÄAppSecret',
    'token'  => 'ÄãµÄToken',
];

µÇ¼ºó¸´ÖÆ

ÆäÖÐapp_idºÍsecretΪ΢ÐÅ¿ª·¢ÕßÖÐÐĵÄÏà¹ØÐÅÏ¢¡£

·¢ËÍÇëÇó

ʹÓÃÏÂÃæµÄ´úÂë¿ÉÒÔ·¢ËÍÇëÇó£º

Á¬Ã¦Ñ§Ï°¡°PHPÃâ·ÑѧϰÌõ¼Ç£¨ÉîÈ룩¡±£»

use EasyWeChatFactory;

$config = [
    'app_id' => 'ÄãµÄAppID',
    'secret' => 'ÄãµÄAppSecret',
    'token'  => 'ÄãµÄToken',
];

$app = Factory::officialAccount($config);

$response = $app->qrcode->temporary($scene_id);

µÇ¼ºó¸´ÖÆ

Õâ¸öÀý×ÓʹÓÃÁËEasyWeChatÖеÄFactoryÀàÀ´¹¹½¨Î¢ÐÅAPIµÄʵÀý¡£qrcodeÊÇEasyWeChatÖеÄÒ»¸öAPI¶Ëµã £¬ÓÃÓÚ½¨Éè¶þάÂë £¬temporaryÔòÊǸÃAPI¶ËµãϵÄÒ»¸öÒªÁì¡£

»ñȡ΢ÐÅ·µ»ØЧ¹û

EasyWeChat»á·µ»ØÒ»¸öÏìÓ¦¹¤¾ß¡£¿ÉÒÔͨ¹ýÒÔÏ´úÂë»á¼ûÏìÓ¦ÄÚÈÝ£º

echo $response->ticket; // »ñÈ¡¶þάÂëticket

µÇ¼ºó¸´ÖÆ

ʾÀý´úÂë

½¨ÉèÒ»¸öTestControllerÀ´²âÊÔ΢ÐÅSDK£º

<?php

declare(strict_types = 1);

namespace appcontroller;

use thinknnotationInject;
use EasyWeChatFactory;

class Test 
{
    /**
     * @Inject
     * @var     hinkApp
     */
    protected $app;

    public function test() 
    {
        $config = [
            'app_id' => 'ÄãµÄAppID',
            'secret' => 'ÄãµÄAppSecret',
            'token'  => 'ÄãµÄToken',
        ];

        $app = Factory::officialAccount($config);

        $response = $app->qrcode->temporary(123);

        echo $response->ticket;
    }
}

µÇ¼ºó¸´ÖÆ

ÔÚä¯ÀÀÆ÷Öлá¼ûhttp://localhost/test/test½«¿´µ½Ò»¸ö¶þάÂëticket¡£

½áÓï

ÔÚThinkPHP6ÖÐʹÓÃ΢ÐÅSDKºÜÊÇÀû±ã £¬Ö»ÐèҪʹÓÃEasyWeChatÕâ¸ö¿â £¬¾Í¿ÉÒÔÇáËɵؼ¯³É΢ÐŹ¦Ð§¡£±¾ÎÄÏÈÈÝÁË×°Öá¢ÉèÖà £¬ÒÔ¼°·¢ËÍÇëÇóºÍ»ñÈ¡ÏìӦЧ¹ûµÄÒªÁì¡£ÈôÊÇÄãÐèҪʹÓÃ΢ÐÅSDK¾ÙÐпª·¢ £¬ÇëʵÑéÒ»ÏÂÕâ¸ö¿â¡£

ÒÔÉϾÍÊÇÔõÑùÔÚThinkPHP6ÖÐʹÓÃ΢ÐÅSDK£¿µÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí £¬°æȨÕùÒéÓë±¾Õ¾ÎÞ¹Ø £¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í尊龙凯时人生就是博ÂËÓÍ»úÍø¹Ù·½Ì¬¶È £¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ £¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢ £¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢ £¬ÇëÄúÁ¬Ã¦ÁªÏµ尊龙凯时人生就是博ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ尊龙凯时人生就是博

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎå £¬9:30-18:30 £¬½ÚãåÈÕÐÝÏ¢

QR code
sitemap¡¢ÍøÕ¾µØͼ