我正在使用这个简单的.htaccess文件进行我的休息服务实现
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^([a-zA-Z_-]*)$ get_price.php?name=$1 [nc,qsa]
目前使用$ _GET方法正常工作并返回
{
status: 200
status_message: "Record found"
data: "kashif@gmail.com"
}
但是我使用$ _POST传递参数,它返回
{
status: 200
status_message: "Record found"
data: ""
}
任何想法我在哪里做错了。我不是.htaccess文件的专家。
下面是我的简单测试类get_price.php。
<?php
header("Content-Type:application/json");
include 'header.php';
$name = $_REQUEST['name'];
$friendResult = mysqli_query($con,"SELECT id FROM user
WHERE name='$name'");
$row = mysqli_fetch_array($friendResult);
$data = $row['id'];
deliver_response(200,"Record found",$data);
function deliver_response($status,$status_message,$data){
header("HTTP/1.1 $status $status_message");
$response['status'] = $status;
$response['status_message'] = $status_message;
$response['data'] = $data;
$json_response = json_encode($response);
echo $json_response ;
}
?>