gpt4 book ai didi

PHP 脚本 fopen 无法打开流 : > Invalid argument Error

转载 作者:可可西里 更新时间:2023-11-01 00:33:38 25 4
gpt4 key购买 nike

我收到警告。

Warning: fopen(76561197992146126 .txt): failed to open stream: Invalid argument in C:\wamp\www\Download\t3.php on line 6

对于任何想知道的人,这是下面 main.txt 的内容 ( http://pastebin.com/53chSRRz )

<?php
$APIkey = 'APIKeyHere';
$file = file('C:\wamp\www\Download\main.txt');
foreach ($file as $link) {
$link2 = "http://api.steampowered.com/ITFItems_440/GetPlayerItems/v0001/?key=" . $APIkey . "&SteamID=" . $link . "&format=json";
$downloaded = file_get_contents($link2);
$fh = fopen($link . ".txt", "a"); //or die("can't open file");
fwrite($fh, $downloaded);
}
echo "Finished";
?>

如果我用静态文件名替换“fopen($link . “.txt”, “a”)”,它就可以工作。但我需要 $link 作为文件名。这对我的设置来说是必不可少的。

我正在使用 WAMP 2.2 和 PHP 5.4.3 运行 Windows 7 x64

最佳答案

您的链接 ID 中有空格。在创建 $link2 之前尝试添加 $link = trim($link);

关于PHP 脚本 fopen 无法打开流 : > Invalid argument Error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16311287/

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