// cakephp 4
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: POST, GET, PUT, PATCH, DELETE, OPTIONS');
header('Access-Control-Allow-Headers: *');
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
exit(0);
}
xxxxxxxxxx
public function init_result() {
header("Access-Control-Allow-Origin: *");
$this->result = array(
'status' => false,
'message' => __("please_provide_information"),
'params' => array(),
);
}