In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article introduces the relevant knowledge of "how to solve the problem that php can not get post". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Php cannot get post: 1, create the project under the working directory of the Apache server; 2, map the apache server directory to the local directory.
This article operating environment: Windows7 system, PHP7.1 version, DELL G3 computer
What if php can't get post?
The solution of not getting post data when php form is submitted
Looking at the address of your browser running php, you will find that the service port number used to open the browser in PhpStorm is 63342 (URL is in the form of localhost:63342/)
So the reason for the problem is that PhpStorm uses its own internal server by default, but does not use the apache server in xampp. PhpStorm, a built-in server, uses port 63342, and there is a problem within the server, resulting in an exception in the POST method; but if you put the project under the working directory of the Apache server, enter localhost in the address bar, and use the Apache server at this time, the default port number is 80th Apache server can run the program normally.
Since there is a problem with the PhpStorm internal server, the solution is to find a way not to use the internal server. There are two ways:
1. Create the project under the working directory of the Apache server, and enter the localhost address directly in the browser address bar each time you run
two。 If you still want to open the browser debugger from PhpStorm, you can do this by changing the configuration:
(1) first map the apache server directory to the local directory
The practice is as follows:
1. Find / xampp/apache/conf/httpd.conf file
two。 Find the code block
3. Add the following code to the child of
# / phpworkspace/: the alias of the directory on other disks is the alias of the directory you want to map to # "E:/phpworkspace/": this is the absolute path of the directory Alias / phpworkspace/ "E:/phpworkspace/" # you can now access the items in the phpworkspace folder under disk E through / / localhost/phpworkspace/.
Add a piece of code at the same level as follows:
AllowOverride All Options Indexes FollowSymLinks Includes ExecCGI Require all granted
It's finished. Now restart Apache and visit: http://localhost/phpworkspace/
(2) then in PhpStorm, find File- > Settings- > Build, Execution, Deployment- > Deployment, which is empty initially. Click the green plus sign to add the local server, and the name localhost is fine. Type selects In place:
After the creation is completed, the default setting under the Connection tab on the right has configured the server as the Apache server under port 80, that is, http://localhost
Change it to the working directory where you map to the local project:
Set the Local path under the Mappings tab to the directory of your local project:
At this time, click the browser from PhpStorm, the accessed URL no longer has the field of port 63342, but uses the local Apache server, and the corresponding form data can be received normally.
This is the end of the content of "how to solve the problem that php can't get post". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.