liasica/yii2-helpers

使用在YII2的一些帮助函数

Installs: 51

Dependents: 1

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 1

Open Issues: 0

Type:yii2-extension

1.0.3 2016-01-28 10:24 UTC

This package is auto-updated.

Last update: 2024-10-24 04:56:03 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License

ArrayTOXml Usage

$xml = new ArrayToXML();
print $xml->buildXML($array);

SimpleArrayToXml Usage

$xml = new SimpleArrayToXml($redpack->redpackData);
var_dump($xmlmodel->buildXML());

Curl Usage

1.curl_get

$curl = new Curl($url);
var_dump($curl->Get());

2.curl_post

$curl = new Curl($url);
$curl->setData($data);
var_dump($curl->Post());

3.curl_post_ssl

$certs = [
    CURLOPT_SSLCERT => 'CURLOPT_SSLCERT.pem',
    CURLOPT_SSLKEY  => 'CURLOPT_SSLKEY.pem',
];
$curl = new Curl($url);
$curl->setData($data)->setCerts($certs);
var_dump($curl->postSSL());

##Unicode Usage #1.encode

$unicode = new Unicode(null, $unicodeStr);
var_dump($unicode->encode());

#2.decode

$unicode = new Unicode($encodeUnicodeStr);
var_dump($unicode->decode());

##Radom Usage #1.Generate an radom str

$radom = new Radom();
var_dump($radom->RadomChars(32));

#2.Get lottery

$proArr = [1 => 1, 2 => 10, 3 => 40];
$radom = new Radom();
var_dump($radom->lottery($proArr));

##Url #1.Get real url

$Url = new Url($uri);
var_dump($Url->realurl());

or

$Url = Url::setUri($uri);
var_dump($Url->realurl());

##Time #1.Get formated microtime

$Time = new Time();
var_dump($Time->microtime_format);

#2. Get timestamp of microtime

$Time = new Time();
var_dump($Time->microtime_float());