redux
次のようにandを使用して、いくつかのデータを php スクリプトに送信したいと考えてpromise
います。
export function fetchFileContent() {
return {
type: "FETCH_FILECONTENT",
payload: axios.post("/api/ide/read-file.php", {
filePath: document.getArgByIndex(0)[0]
})
};
}
しかし、php スクリプトはデータを受信できません。$_POST
を使用してすべてのデータを印刷するとvar_dump
。中には何もありません。
Google Chrome デバッグ ツールで
Request Payloadを確認しましたが、問題ないようです。
私の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'];
そして、私はこの応答を得ました:
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 />
<br />
<b>Notice</b>: Undefined index: filePath in <b>/var/www/html/api/ide/read-file.php</b> on line <b>10</b><br />
どうすればphpスクリプトのデータを取り戻すことができますか?