Commit f5b5dd59 authored by hujun's avatar hujun

生成分享二维码路径修改

parent 1e2d57e4
...@@ -13,6 +13,12 @@ class GenerateCodeUntils { ...@@ -13,6 +13,12 @@ class GenerateCodeUntils {
* @param type $param * @param type $param
*/ */
public function getCode($param, $file_name) { public function getCode($param, $file_name) {
$path = 'static'.DS.'qrcode'.DS.date(Ymd);
if (!file_exists($path)) {
mkdir($path, 0777);
}
$qrCode = new QrCode($param); $qrCode = new QrCode($param);
$qrCode->setSize(300); $qrCode->setSize(300);
$qrCode->setWriterByName('png'); $qrCode->setWriterByName('png');
...@@ -21,7 +27,7 @@ class GenerateCodeUntils { ...@@ -21,7 +27,7 @@ class GenerateCodeUntils {
$qrCode->setForegroundColor(['r' => 0, 'g' => 0, 'b' => 0]); $qrCode->setForegroundColor(['r' => 0, 'g' => 0, 'b' => 0]);
$qrCode->setBackgroundColor(['r' => 255, 'g' => 255, 'b' => 255]); $qrCode->setBackgroundColor(['r' => 255, 'g' => 255, 'b' => 255]);
$qrCode->setValidateResult(false); $qrCode->setValidateResult(false);
$path = 'static/qrcode/'.$file_name.'.png'; $path = $path.DS.$file_name.'.png';
$qrCode->writeFile($path); $qrCode->writeFile($path);
return $path; return $path;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment