可以在php中将变量传递给'file_get_contents'吗?我得到错误,并想知道这是不是我的语法.我使用下面的代码.
$page=file_get_contents('http://localhost/home/form.php?id={$data['form_id']}');
$fp=fopen('form.html','w+');
fputs($fp,$page);
fclose($fp);
Run Code Online (Sandbox Code Playgroud)
要使用此语法,请使用"引号而不是引号'.
$page=file_get_contents("http://localhost/home/form.php?id={$data['form_id']}");
要么
$page=file_get_contents('http://localhost/home/form.php?id='.$data['form_id']);