这很有效:
if(isset($_POST["forms"])) {
$form=$_POST["forms"];
$content = file_get_contents($form);
}
我的文件名是$form,通过";选择";form。
但是这些文件(或者选择表单的选项(位于文件夹中!
出于某种原因。。。下面这个不起作用!
$content = file_get_contents('forms/', $form);
命令file_get_contents非常清楚地指出,第一个操作数就是路径。
所以我试过
$content = file_get_contents("forms/", $form);
$content = file_get_contents('forms', $form);
$content = file_get_contents('forms' $form);
还有许多其他愚蠢的尝试。但在最后,PATH+变量似乎不起作用!这是真的吗?不可能。
RE:"出于某种原因。。。下面这个不起作用">
$content=file_get_contents('forms/',$form(;
而且永远不会。松开逗号。
file_get_contents('forms/', $form);
很可能不起作用,因为file_get_contents()
只有一个参数(没有逗号(,即文件名
不确定,但可能试试
$content = file_get_contents("forms/$form");
或者更有可能是
file_get_contents("./forms/$form");