async function localhost(request){
var request = "http://localhost/"+request;
let response = await fetch(request, { mode: "no-cors" });
let json = await response.json();
console.log(json);
}
Response {
body: (null)
bodyUsed: false
headers: Headers {
[[Prototype]]: Headers
append: ƒ append()
delete: ƒ delete()
entries: ƒ entries()
forEach: ƒ forEach()
get: ƒ ()
has: ƒ has()
keys: ƒ keys()
set: ƒ ()
values: ƒ values()
constructor: ƒ Headers()
Symbol(Symbol.iterator): ƒ entries()
Symbol(Symbol.toStringTag): "Headers"
[[Prototype]]: Object
}
ok: false
redirected: false
status: 0
statusText: ""
type: "opaque"
url: ""
[[Prototype]]: Response
arrayBuffer: ƒ arrayBuffer()
blob: ƒ blob()
body: (…)
bodyUsed: (…)
clone: ƒ clone()
formData: ƒ formData()
headers: (…)
json: ƒ json()
ok: (…)
redirected: (…)
status: (…)
statusText: (…)
text: ƒ text()
type: (…)
url: (…)
constructor: ƒ Response()
Symbol(Symbol.toStringTag): "Response"
get body: ƒ body()
get bodyUsed: ƒ bodyUsed()
get headers: ƒ headers()
get ok: ƒ ok()
get redirected: ƒ redirected()
get status: ƒ status()
get statusText: ƒ statusText()
get type: ƒ type()
get url: ƒ url()
}
sudo php-fpm7.4 -c index.php
очень странны, ругается на скобку в первой строке: header('Content-Type: text/plain; charset=UTF-8');
PHP 7.4.3 (cli) (built: Oct 25 2021 18:20:54) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies
Uncaught Error: Call to undefined function fastcgi_finish_request()
. Аналогично и с классом. Что-то php.net начал неожиданно подводить, сначала класс не находит, потом функцию. PHP версия 7.4...