注意:使用未定义的常数OK-假定为“ OK”

时间:2019-11-23 08:27:16

标签: php

我收到此警告消息,

  

“注意:使用未定义的常数OK-假定为'OK'”

我已经尝试过"OK"'OK',但是它们都会触发警告。

此外,我只会在服务器上收到此错误,而在本地不会。

<?php
$post_data = http_build_query(
    array(
        'email' => $_GET['email'],
    )
);
$opts = array('http' =>
    array(
        'method' => 'POST',
        'header' => 'Content-type: application/x-www-form-urlencoded',
        'content' => $post_data
    )
);

$context = stream_context_create($opts);
if ($_GET['email']) {
    $response = file_get_contents('https://url.delibr.com/webhooks/example', false, $context);
    if ($response == "OK") {
        echo $_GET['email'] . " has received an invite!";
    } else {
        echo "Unknown error!" . $response;
    }

}
?>

0 个答案:

没有答案