PHP code example of cocolait / cp_helper

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

    

cocolait / cp_helper example snippets


composer 

//发送邮件
$mail_option = [
      'send_name' => 'Cocolait博客',//发送人的名称
      'host' => 'smtp.mxhichina.com',//设置SMTP服务器
      'username' => 'xxxx',//邮件
      'password' => 'xxxx'
];
$content = "<p>这是一个很美好的开始,确实很精彩</p>";
$data = \cocolait\helper\CpEmail::send('[email protected]','优美的文章',$content,$mail_option);

// excel表格处理
// 导入Excel文件
$data = \cocolait\helper\CpExcel::importExcel();
// 导出Excel文件
$data = \cocolait\helper\CpExcel::exportExcel('文件名称','设置Excel表格第一行的显示','需要导出的所有数据');
// Excel转换Array
$data = \cocolait\helper\CpExcel::excelFileToArray('Excel文件全路径','文件后缀 默认是 xls');

// 创建普通二维码
\cocolait\helper\CpQrCode::create('http://www.mgchen.com');
// 创建带有标题且有LOGO的二维码
\cocolait\helper\CpQrCode::create('http://www.mgchen.com',$size = 240, $title = 'cocolait', $logo = './logo.png');