PHP code example of yjyer / phptools

1. Go to this page and download the library: Download yjyer/phptools 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/ */

    

yjyer / phptools example snippets




namespace app\test;

use yjyer\YJYTools;
use yjyer\YJYHttp;

/**
 * 测试类
 */
class Developer extends Base
{
    /**
     * 测试
     */
    public function test()
    {
        // 数组转完成xml字符串
        $xmlFull = YJYTools::arrayToXmlFull([
            'response' => $response_xml,
            'sign' => $sign,
            'sign_type' => $sign_type,
        ], 'alipay', 'item', '', 'id', $charset);
        print_r($xmlFull);

        // 判断当前环境是否为微信浏览器
        YJYTools::isWeixin();

        // 发送模拟GET或POST请求
        YJYHttp::getRequest($url)

        $data=[
            'user_name' => 'admin',
            'pwd' => '123'
        ];
        YJYHttp::postRequest($url,$data)

        // 更多请查看对应文件里的方法

    }
}