Failed to pay for ThinkPHP5 cross-domain verification code.

did

when processing OPTIONS request
 if (isset($_SERVER["HTTP_ORIGIN"])) {
            header("Access-Control-Allow-Origin:" . $_SERVER["HTTP_ORIGIN"]);
        }
        header("Access-Control-Allow-Headers: SET-COOKIE,COOKIE,token,Origin, X-Requested-With, Content-Type,withCredentials");
        header("Access-Control-Allow-Methods: OPTIONS,POST,GET,DELETE,PUT");
        header("Access-Control-Allow-Credentials: true");

        if ($request->isOptions()) {
            exit;
        }

but the CAPTCHA still cannot be verified successfully!
the front-end axios has also been added

axios.defaults.withCredentials = true;

both apache and nginx are the same, even if you get rid of the above code and use nginx for cross-domain processing, it will not be solved!

or is there something wrong with the way I get the CAPTCHA at the front end?

the front end uses vue to directly give the address of the CAPTCHA to img

when obtaining the CAPTCHA.

 <img :src="captcha" @click="getImgCaptcha">
 getImgCaptcha() {
     this.captcha = this.$api + "captcha?time=" + Math.random();
},
Nov.02,2021

to obtain the verification code and verify some APIs, you must carry cookie


first of all, there is no cross-domain problem with the image. It is recommended that you verify whether your request for the image API is correct and what the data returned to the image interface is.


is it a cross-domain problem or can't pass due to different session on both sides? first confirm that the solution

CAPTCHA cannot be displayed?
or did validation fail when submitting validation?
I can't even ask a question clearly.


Thank you for answering that my front-end code was written incorrectly. When I clicked on the verification code, I went to get the graphic verification code at the same time. The statement to obtain the graphic verification code should be written to
after the response. All the answers are appreciated. Thank you for your help.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e4da27-4c654.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e4da27-4c654.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?