How to solve the problem that the waiting time is too long for the background phpqrcode to receive the foreground parameters and generate the WeChat Pay QR code to the foreground display?

the foreground user chooses the time to top up, calculates the total amount after receiving it at the background, and then generates a QR code through phpqrcode to display it at the front end. But this time is too long, and it takes about three or four seconds to display each time. Obviously, this will not work.
at first I output the image directly to the page, but it takes a long time to wait, and then I want to use it to convert the image to base64, but it doesn"t work either. I use ajax to send the data to the background, generate the base64, of the QR code, and then send it back to the front end.
how can I shorten this interval?
time interval for generating QR codes:

clipboard.png

clipboard.png

ajax:

clipboard.png

clipboard.png

clipboard.png
above is the background method of the execution, and below is the base64 bit encoding of the returned image

Php
Mar.15,2021

first confirm whether it takes too long to generate the QR code, or it takes too long to load the picture


just generate it with JS


find the problem, because the method to generate the QR code is automatically loaded in the frame constructor. Loading it in the method of generating a QR code will significantly shorten the time

Menu