我需要向字符串'SUCCESS'发送HTTP 200响应,但我的php服务器版本是5.2.17!
在我的情况下,webhook将数据发送到捕获到名为notification.php的文件,我读取了contentes,保存在数据库中并需要发送响应但不知道如何执行此操作!
有谁知道如何在php 5.2.17中执行此操作?
我尝试了以下方法但没有成功:
// error 1
header("Content-Type: text/plain");
echo "SUCCESS";
// error 2
$httpStatusCode = 200;
$httpStatusMsg = 'SUCCESS';
$protocol = isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0';
header($protocol.' '.$httpStatusCode.' '.$httpStatusMsg);
// error 3
header("200 SUCCESS");
return "200 SUCCESS";
// error 4
header('Content-Type: application/json');
echo 'SUCCESS';
// error 5
header('Content-Type: application/json');
return 'SUCCESS';
//error 6
header('Content-Type: application/json');
header('SUCCESS');
///error 7
header('Content-Type: application/json');
$success =json_encode('SUCCESS');
header($success);
///error 8
header("HTTP/1.1 200 SUCCESS");
header("Content-Type:application/json; charset=utf-8");
///error 9
header("HTTP/1.1 200");
header("Content-Type:application/json; charset=utf-8");
result 'SUCCESS';
//error 10
header("Content-Type:application/json;");
header('HTTP/1.0 200 SUCCESS');
// error 11
$code = 200;
$text = 'OK';
$protocol = (isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0');
header($protocol . ' ' . $code . ' ' . $text);
$GLOBALS['http_response_code'] = $code;
echo 'SUCCESS';
我的PhpCode
<?php
$src_data = $_REQUEST["data"];
$une_data = stripslashes($src_data);
$data = json_decode($une_data);
//get payment data
$id_cob = $data->payment->id;
$id_cus = $data->payment->customer;
$status = $data->payment->status;
$dtsts = date("Y-m-d");
if ($data->event == 'PAYMENT_RECEIVED') {
// post client
include('dbconnection.php');
$qryn = "UPDATE PAYMENTS SET STATUS='$status', DATASTATUS='$dtsts' WHERE ID_COB_ASAAS='$id_cob' AND ID_CLI_ASAAS='$id_cus'";
mysql_query($qryn,$cnx);
}
// webhook return
// my solution was:
header('HTTP/1.1 200 OK');
echo 'SUCCESS';
return;
?>
答案 0 :(得分:5)
200是标准返回码。
所以
.introduction {
background-image: url('../images/karma-background.jpg');
}
基本上应该足够了。
答案 1 :(得分:0)
我使用了以下内容:
echo "SUCCESS";
http_response_code(200); // PHP 5.4 or greater
这似乎有效。
答案 2 :(得分:-5)
尝试:
ARRAY start{*} col1 col5 col8 var1;
DO OVER start;