嗨,我使用此代码在指定目录中查找文件。这可行,但我希望当我点击 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