如何将php变量传递给fopen

I'm struggling to use a php function, fopen with multiple variables.

I have two variables: $language is the extension ( E.G. .php ) and $url is a random number generated at the start of the script.

Here is my code but it always throws the die statement and doesn't work

$filename = "tools/scripts/tool".$language."?id=".$url;
$fh = fopen($filename, "w") or die("There Was An Error With The Script."); 

Thanks

fopen will open the files content itself. It doesn't parse the file.

You might use exec() or you can call the file over a webserver.

fopen('http://localhost/yourfile.php?param='.$param);

Not to mention, that you are trying to write to a file there... ,"w")

yourfile.php?param=123 <- is not a valid filename