PHP code example of lichv / utils

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

    

lichv / utils example snippets



ragent = new \Utils\UserAgent();


if($useragent->is('iOS')){
	echo 'this os is ios';
}elseif ($useragent->is('AndroidOS')) {
	echo 'this os is ios';
}

if($useragent->isMobile()){
	echo 'this device is mobile';
}elseif ($useragent->isTablet()) {
	echo 'this os is tablet';
}

$result = \Utils\Sms::getInstance(['account'=>'myaccount','password'=>'mypasspord'])->send(['to'=>'15812345678','content'=>'亲爱的用户,您的活动验证码是123456,感谢您的参与此次活动。']);





	$downloadImg = new \Utils\DownloadImages();
	$downloadImg->setRemoteUrl("https://www.baidu.com/img/bd_logo1.png", true)
	->setLocalPath("/var/data/")
	->setLocalName("bd_logo1.png");
	$copySize = $downloadImg->download();
} catch (Exception $e) {
	return ['state'=>$e->getCode(),'msg'=>$e->getMessage()];
}

var_dump($copySize);