您好我使用此代码在指定的目录中查找文件。这个工作,但我想,当我在resoutt双击它,在新标签页中打开我想要在新标签页中打开搜索结果
代码:
<?php
$dir = 'ups';
$exclude = array('.','..','.htaccess');
$q = (isset($_GET['q']))? strtolower($_GET['q']) : '';
$res = opendir($dir);
while(false!== ($file = readdir($res))) {
if(strpos(strtolower($file),$q)!== false &&!in_array($file,$exclude)) {
echo "<a href='$dir/$file'>$file</a>";
echo "<br>";
}
}
closedir($res);
?>
当我使用
<?php
echo "<a href='$dir/$file'>$file target = "_blank"</a>";
?>
这表明:
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/u688698883/public_html/search/ss.php on line 8
如果你只是想你'在新标签openned $ file',加上'目标= “_空白”'你'了'元素。 –