getInstance() Gets a singleton of any class


##getInstance( ) method

Return value:

Instance Object

Gets the singleton of any class, QueryList internal method, open for everyone to use.

Prototype:

getInstance($class,$arg1,$arg2,……)

Parameters: $class

Type:

string

The class name containing the namespace

Parameters: $arg1, $arg2,...

You can pass any number of parameters


##UsageTo run the following example, you need to install the

Http

library:

composer require jaeger/http
<?php
require 'vendor/autoload.php';
use QL\QueryList;
$http = QueryList::getInstance(QL\Ext\Lib\Http::class);
$html = $http->get('http://www.baidu.com');
print_r($html);