$_GET-我如何从路径中获取名称和类型


$_GET- how can i get name and type from the path?

in items.php

$filepath = mysql_real_escape_string($_GET['filepath']);
$name = mysql_real_escape_string($_GET['name']);
$type = mysql_real_escape_string($_GET['type']);
echo $name,$type;
echo '<td><a target='"_blank'" href="'.$filepath.'" title='"'">'.$filepath.'</a> ';
错误:

注意:未定义索引:name
注意:未定义索引:type

result: images/ch1.pdf?name=number?type=Memo

您只使用一个问号?,然后用&号&分隔变量

看起来应该像

images/ch1.pdf?name=number&type=Memo

如果您使用GET(如index.php?name=foo&type=bar)将参数传递给脚本,则应该能够在PHP中使用$_GET接收它们,因此您的代码看起来应该可以工作。

我建议删除mysql_real_escape_string。它可能会搞砸你的脚本。