Home > Article > Backend Development > javascript - Sina Cloud Server can only use form to request session, but ajax cannot request it??
When writing the php verification code
page, I stored the php file on the Sina cloud server. I thought about using ajax request session
in the javascript
page to verify the verification code. I feel that this method should be feasible, but in reality During the operation, I found that the session
retrieved using ajax
was always empty and was not requested. One of the reasons was that the code was written incorrectly. I pondered hard and looked it up in various ways. Finally, I found that netizens said that Sina Cloud could not save the session.
, but when I use form
to make a request, I can get the session
value. Why is this? Please solve...
When writing the php verification code
page, I stored the php file on the Sina cloud server. I thought about using ajax request session
in the javascript
page to verify the verification code. I feel that this method should be feasible, but in reality During the operation, I found that the session
retrieved using ajax
was always empty and was not requested. One of the reasons was that the code was written incorrectly. I pondered hard and looked it up in various ways. Finally, I found that netizens said that Sina Cloud could not save the session.
, but when I use form
to make a request, I can get the session
value. Why is this? Please solve...
If you don’t use a framework, there must be session_start() at the front of the PHP file, and then $_SESSION will work in the file
<code><?php session_start();</code>