gpt4 book ai didi

php - 为什么 FILE_APPEND 给我一个错误文件未找到,但 "true"工作正常但不追加

转载 作者:搜寻专家 更新时间:2023-10-31 21:27:14 25 4
gpt4 key购买 nike

这是我的代码片段:我不得不用 FILE_APPEND 注释掉这一行。我不明白这是怎么回事。特别是因为当我使用 FILE_APPEND 时,它会出现找不到文件的错误。

echo '<br />';
$rssrecord = json_encode($rss);
var_dump($rssrecord);

// Update the Rss feed file
require_once('/appconfig.php');

$app = new pathConfig;
$filePath = $app->getPath(); // Set Getter
var_dump($filePath); // outputs all paths
echo "<br><br>";
$jsonPath = $filePath['json']; // Getter for json
echo $jsonPath;
$rssFile = "rss.json";
$putfile = ($jsonPath.$rssFile);
echo '<br />';
echo $putfile;
//file_put_contents($putfile, $rssrecord.PHP_EOL, FILE_APPEND);
file_put_contents($putfile, $rssrecord.PHP_EOL, true);

最佳答案

此问题是“权限”问题。我检查了文件属性和安全性,发现我没有读/写权限,也不能授予自己权限。然后我确实在另一个路径中创建了一个文件,它运行良好。

关于php - 为什么 FILE_APPEND 给我一个错误文件未找到,但 "true"工作正常但不追加,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34302527/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com