我想通过使用redux和发送一些数据到PHP脚本,promise如下所示.
export function fetchFileContent() {
return {
type: "FETCH_FILECONTENT",
payload: axios.post("/api/ide/read-file.php", {
filePath: document.getArgByIndex(0)[0]
})
};
}
Run Code Online (Sandbox Code Playgroud)
但是php脚本无法接收数据.当我打印的所有数据$_POST使用var_dump.里面什么都没有.
我在Google Chrome调试工具中查看了" 请求有效负载 ",这似乎没问题.

在我的PHP脚本中:
if (isset($_POST["filePath"]))
echo "yes";
else
echo "no";
echo "I am the correct file";
var_dump($_POST["filePath"]);
$dir = $_POST['filePath'];
echo $_POST['filePath'];
Run Code Online (Sandbox Code Playgroud)
我收到了这个回复:
noI am the correct file<br />
<b>Notice</b>: Undefined index: filePath in <b>/var/www/html/api/ide/read-file.php</b> on line <b>7</b><br />
NULL
<br />
<b>Notice</b>: Undefined index: filePath in <b>/var/www/html/api/ide/read-file.php</b> on line <b>9</b><br /> …Run Code Online (Sandbox Code Playgroud) 如何在c/c ++中压缩文件?因为我想开发像WinZip/WinRAR这样的应用程序.一个更简单的.