PHP code example of szjcomo / utils

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

    

szjcomo / utils example snippets


$Mailer = new \szj\utils\Mailer;
$title    = '测试发送';
$content  = '<h1>这是一封测试邮件</h1>';
$username = 'xxxxxx';//邮箱账号
$password = 'xxxxxx';//邮箱密码
$tomail = 'xxxxxxxx';//收件人账号 可以是数组或字符串(,)号分割
$result = $Mailer->send($title,$content,$username,$password,$tomail);
var_dump($result);

$Mailer = new \szj\utils\Mailer;
$title    = '测试发送';
$content  = '<h1>这是一封测试邮件</h1>';
$username = 'xxxxxx';//邮箱账号
$password = 'xxxxxx';//邮箱密码

$title    = '测试发送';
$content  = '<h1>这是一封测试邮件</h1>';
$username = 'xxxxxx';//邮箱账号
$password = 'xxxxxx';//邮箱密码
$tomail   = 'xxxxxxxx';//收件人账号 可以是数组或字符串(,)号分割
$config = [
	'Subject'=>$title,
	'Body'=>$content,
	'Username'=>$username,
	'Password'=>$password,
	'addAddress'=>$tomail,
	'FromName'=>'como'//发件人昵称
];
$Mailer = new \szj\utils\Mailer($config);
$result = $Mailer->send();
var_dump($result);

$map = new \szj\utils\Map;

$config = ['ak'=>'xxxxxxxxxxx'];
$map = new \szj\utils\Map($config);

$result = $map->GetLngLat('广东省河源市源城区永福农贸中心市场');
print_r($result);

$data = ['lng'=>114.686561,'lat'=>23.767418];
$points = [
	['lng'=>114.686561,'lat'=>23.767418],
	['lng'=>114.686561,'lat'=>23.767418],
	['lng'=>114.686561,'lat'=>23.767418],
	['lng'=>114.686561,'lat'=>23.767418]
];
$bool = $map->IsPoint($data,$points);
var_dump($bool);//如何在区域内 true/false

$orgStr = '23.766225,114.69726|23.743624,114.69854';
$destStr = '23.765124,114.690214|23.650109,114.666172|23.743624,114.69854';
$result = $map->Distance($orgStr,$destStr);
print_r($result);