如何将Base64字符串转换为Image并将图像保存到文件夹并在PHP中获取文件路径?

时间:2018-08-20 15:43:10

标签: php mysql

我可以将Base64字符串转换为图像(jpg,png等)并将该图像保存到文件夹并获取图像文件路径吗?在下面的代码中,我获得了$ Photo 1,2和3,其中包含Base64 String。

PHP API:

$json_str = file_get_contents('php://input');
    $json_obj = json_decode($json_str);
    $EmpNo = $json_obj->EmpNo;
    $Date = $json_obj->CafDate;
    $CustomerID = $json_obj->CustomerID;
    $StartTime = $json_obj->StartTime;
    $EndTime = $json_obj->EndTime;
    $Photo1 = $json_obj->Photo1;
    $Photo2 = $json_obj->Photo2;
    $Photo3 = $json_obj->Photo3;
    $Remarks = $json_obj->Remarks;
    $OthersText = $json_obj->OthersText;
    $Rekorida = $json_obj->Rekorida;
    $Merchandizing = $json_obj->Merchandizing;
    $TradeCheck = $json_obj->TradeCheck;
    $Others = $json_obj->Others;
    $GPS = $json_obj->GPS;
    $CafDate = date("Y-m-d", strtotime($Date));

0 个答案:

没有答案