PHP code example of handsomegyr / wechat

1. Go to this page and download the library: Download handsomegyr/wechat library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

handsomegyr / wechat example snippets



$client = new \Weixin\Client();
$client->setAccessToken($access_token);

echo "<br/>将一条长链接转成短链接接口<br/>";
$long_url = 'http://www.baidu.com/?a=1&b=2&c=3';
$ret = $client->getShortUrlManager()->long2short($long_url);
print_r($ret);