【发布时间】:2020-08-05 18:43:34
【问题描述】:
我想通过 PHP 发送 url 的字符串(这必须返回一个 JSON),但我想有一个编码问题。 我在我的 PHP 中使用 file_get_contents("php://input") 来获取此 url 的字符串。但这是不可能的。当我向 PHP 发送 JSON 时,此代码正在工作。是否存在编码问题?
var urlString='https://google.com';
$.ajax({
type : 'POST',
url : 'https://example.php',
//contentType: 'application/json',
data: urlString , //I want to send this
dataType: 'json'
});
【问题讨论】: