Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/452.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用React获取cURL请求_Javascript_Html_Reactjs_Curl - Fatal编程技术网

Javascript 使用React获取cURL请求

Javascript 使用React获取cURL请求,javascript,html,reactjs,curl,Javascript,Html,Reactjs,Curl,我有个要求 curl-X GET”http://localhost:8000/get/folder“-H”accept:application/json“-H”path:/”类似的东西应该可以工作 fetch('http://localhost:8090/get/directory', { 标题:{ “接受”:“应用程序/json”, “路径”:“/”, } }) .then(response=>response.json()) .then(json=>console.log(json));

我有个要求


curl-X GET”http://localhost:8000/get/folder“-H”accept:application/json“-H”path:/”
类似的东西应该可以工作

fetch('http://localhost:8090/get/directory', { 
标题:{
“接受”:“应用程序/json”,
“路径”:“/”,
}
})
.then(response=>response.json())
.then(json=>console.log(json));
例如,您可以在React应用程序中的
useffect()
中调用此函数。或者
componentDidMount
,如果它是类组件