Keka Direktor
Keka Direktor
KPCKevin Powell - Community
Created by Keka Direktor on 11/11/2023 in #back-end
CORS Blocking My Request
I include this in my backend: header("Access-Control-Allow-Origin: *"); header("Access-Control-Allow-Headers: *"); header("Content-type: application/json; charset=UTF-8"); When I want to post some data inside react redux I get this error response to preflight request doesn't pass access control check it does not have http ok status but when I delete this line code works.... http_response_code(422);
6 replies
KPCKevin Powell - Community
Created by Keka Direktor on 11/6/2023 in #back-end
SYNTAX ERROR PROBLEM INSIDE OOP PHP
My problem is: syntax error, unexpected 'private' (T_PRIVATE), expecting variable (T_VARIABLE) When I do this: public function __construct(private ProductGateway $gateway) {
} and call $getway there: private function processCollectionRequest(string $method): void { switch($method) { case "GET": echo json_encode($this->gateway->getAll()); break; } } I got this error: syntax error, unexpected 'private' (T_PRIVATE), expecting variable (T_VARIABLE)
31 replies