Browse Source

提交打印pdf的处理

lvhao 1 week ago
parent
commit
c61d77d094
1 changed files with 20 additions and 1 deletions
  1. 20 1
      core/CoreApp/controllers/Systemprint.php

+ 20 - 1
core/CoreApp/controllers/Systemprint.php

@@ -2007,7 +2007,7 @@ class Systemprint extends Start_Controller {
         file_put_contents($pdf_path.$title.'.pdf',$file_base64);
 		return $bctime;
     }
-	public function _pdfurl($pdf,$title,$bctime)
+	public function _pdfurlbak($pdf,$title,$bctime)
     {
     	$pdf_path = './data/pdf/'.$bctime.'/';
         $pdf = fopen($pdf,"r");
@@ -2015,6 +2015,25 @@ class Systemprint extends Start_Controller {
         file_put_contents($pdf_path.$title.'.pdf',$pdf);
 		return $bctime;
     }
+
+	public function _pdfurl($pdf, $title, $bctime)
+	{
+		$pdf_path = './data/pdf/' . $bctime . '/';
+		
+		// 创建目录(如果不存在)
+		if (!is_dir($pdf_path)) {
+			mkdir($pdf_path, 0777, true);  // 第三个参数 true 可以递归创建目录
+		}
+		
+		// 获取PDF内容
+		$pdf_content = file_get_contents($pdf);
+		
+		// 保存文件
+		file_put_contents($pdf_path . $title . '.pdf', $pdf_content);
+		
+		return $bctime;
+	}
+
 	
 	public function _exceldy()
 	{