简体   繁体   中英

PHP Post request returning 405 Not Allowed

Just started with PHP and when trying to POST request to my code it's returning 405 Not Allowed

Here's my code:

<?php
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Credentials: true");
header("Access-Control-Allow-Methods: GET,HEAD,OPTIONS,POST,PUT");
header("Access-Control-Allow-Headers: Access-Control-Allow-Headers, Origin,Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers");

$result = "info: ";

if( $_POST['email']) {
    $result .= $_POST['email'];
}

echo $result;

?>

Just had to run xampp with my php file in it's htdocs folder, thank you everyone!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM