/*
* base64转pdf
*/
function base642pdf($formTxt,$toPdf)
{
$file = file_get_contents($formTxt);//读
$data = base64_decode($file);//转换
file_put_contents($toPdf, $data);//写
}
/*
* pdf转base64
*/
function pdf2base64($formPdf,$toTxt)
{
$file = file_get_contents($formPdf);//读
$data = base64_encode($file);//转换
file_put_contents($toTxt, $data);//写
}
<?php $a="JVBERi0xLjQKJeLjz9MKOSAwIG9iago8PC9UeXBlL1hPYmplY3QvUmVzb3VyY2VzPDwvUHJvY1NldFsvUERGL1RleHQvSW1hZ2VCL0ltYWdlQy9JbWFnZUldL0ZvbnQ8PC9GMSAxMCAwIFIvRjIgMTEgMCBSPj4+Pi9TdWJ0eXBlL0Zvcm0vQkJveFswIDAgODQxLjg5IDU5NS4yOF0vTWF0cml4WzEgMCAwIDEgMCAwXS9MZW5ndGggMjgwMy9Gb3JtVHlwZSAxL0ZpbHRlci9GbGF0ZURlY29kZT4+c3RyZWFtCnicrZldb1tHDobv9SsG2Ju0gE/m+8N3qZ1kUySN1/bWyba90DqyrUaWXFtpkH+/JGeOhpSVQAEWQdG8Ec9zZoYckjPnr4lWoYTBZnULf9VqMcneDLnwvzaDxeRmcjFZToz6PLHqZzD/c2K0ejP57Q+tPkz+oue1ur+e/HQ+efrCKGMGm9T5FTyBP+A/6KF4FVwZjFPn8MbBJR+jOr+cPPlRPTs9+uerX5+r47dH6scfzv8EIPzw/LzyrIpDio9wSQWbh2QaziSdCffLaq3WK/XfmZqu19PLm9kHlHfTy4/T6xmH06gHrV2xOHZr/ZCCCsHi224nNvkhpFEvNtrGIXjUzX7UNxMcIP7pC2HtEBwfubVh0PCQ0zSl28mBGXRdhouTd49GR+MqYOJU8OALg+PKeQgGtBlSgfc6bfEHocsoUeSqYCCoQiClk7rsj+ohGvjVDLE6KZOwhYRzZGoGY0hr/FUjPbg8xEC2OYwKbdPg46gXW9rpPLhYX4OkQlwYQsFHwbMGxuDt4Og3O07c6TCEjbrcWpYFLL7NacBReBwhrFOx6Bgik79KHrLh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