PHP脚本fopen无法打开流:>无效参数错误

Sup*_*r1o 3 php fopen

我收到了警告.

警告:fopen(76561197992146126 .txt):无法打开流:第6行的C:\ wamp\www\Download\t3.php中的参数无效

对于任何想知道的人,这是下面的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";
?>
Run Code Online (Sandbox Code Playgroud)

如果我用"静态文件名"替换"fopen($ link.".txt","a")",它就可以了.但我需要$ link作为文件名.我的设置势在必行.

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

Mar*_*ell 6

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

  • 圣洁的废话.你不知道我花了多长时间用这条细线修复它.非常感谢xD (3认同)