使用mpdf 生成pdf文件 PHP
首先安装mpdf composer require mpdf/mpdf
public function testpdf(Request $request){
$mpdf = new Mpdf(['tempDir'=>runtime_path().'/pdftmp']);
$mpdf->autoScriptToLang = true;
$mpdf->autoLangToFont = true;
$html = <<<EOD
<h1 style='text-align:center;'>Hello World你好啊</h1>
EOD;
$mpdf->WriteHTML($html);
//public_path().'/pdf/'
$file = public_path().'/pdf/'.time().'.pdf';
$mpdf->Output($file,'F');
return response()->download($file, time().'.pdf');
}
mysql CONVERT_TZ 返回NULL问题 MySQL
1.SELECT CONVERT_TZ(create_time, 'UTC', 'MET') AS local_time FROM la_test
limit 1
2.SELECT CONVERT_TZ(create_time, '+00:00', '+08:00') AS local_time FROM la_test
limit 1
使用第一种方式可能会导致响应为NULL,可以使用第二种方式
乌班图修改为UTC时区 服务器
1.查询可用时区列表
timedatectl list-timezones
2.设置为UTC时区
sudo timedatectl set-timezone UTC
3.同步时区
apt install ntpdate
sudo ntpdate cn.pool.ntp.org
查看当前时间
date -R