PHP:变量在函数内部不起作用?
echo $path; //working
function createList($retval) {
echo $path; //not working
print "<form method='POST' action='' enctype='multipart/form-data'>";
foreach ($retval as $value) {
print "<input type='checkbox' name='deletefiles[]' id='$value' value='$value'>$value<br>";
}
print "<input class='submit' name='deleteBtn' type='submit' value='Datei(en) löschen'>";
print "</form>";
}
我做错了什么?为什么$path在函数外部正确打印,但在函数内部却无法访问?createList