<?php?/****Author:Raphael****/header("Content-type: text/html; charset=utf-8");$path = './';$url = $_SERVER['REQUEST_URI'];if(isset($_GET['dir'])){? ? ? ? $path = $path.'/'.$_GET['dir'].'/';}else{? ? ? ? $url = $url . '?dir=';}$dh = opendir($path);if($dh === false){? ? ? ? echo '打開(kāi)出錯(cuò)';? ? ? ? exit;}$list = array();while(($item = readdir($dh)) !== false){? ? ? ? $list[] = $item;}closedir($dh);?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>新建網(wǎng)頁(yè)</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><style>? ? ? ? td{? ? ? ? ? ? ? ? border:1px solid gray;? ? ? ? }</style></head>? ? <body>? ? ? ? ? ? <h1>文件管理系統(tǒng)</h1>? ? ? ? ? ? <table>? ? ? ? ? ? ? ? ? ? <tr>? ? ? ? ? ? ? ? ? ? ? ? ? ? <td>序號(hào)</td>? ? ? ? ? ? ? ? ? ? ? ? ? ? <td>文件名</td>? ? ? ? ? ? ? ? ? ? ? ? ? ? <td>操作</td>? ? ? ? ? ? ? ? ? ? </tr>? ? ? ? ? ? ? ? ? ? <?php foreach ($list as $k => $v) { ?>? ? ? ? ? ? ? ? ? ? <tr>? ? ? ? ? ? ? ? ? ? ? ? ? ? <td><?php echo $k ?></td>? ? ? ? ? ? ? ? ? ? ? ? ? ? <td><?php echo $v ?></td>? ? ? ? ? ? ? ? ? ? ? ? ? ? <td><?php?? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if(is_dir($path.'./'.$v)) ? //這行不懂,$path 前面不是賦值過(guò)了?和 ./??這兩個(gè)不是重復(fù)了嗎?? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? {? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? echo '<a href="',$url.'/',$v,'">瀏覽</a>';? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? }? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? else? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? {? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? echo '<a href="',$path,$v,'">查看</a>';? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? }? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?>? ? ? ? ? ? ? ? ? ? ? ? ? ? </td>? ? ? ? ? ? ? ? ? ? </tr>? ? ? ? ? ? ? ? ? ? <?php } ?>? ? ? ? ? ? </table>? ? </body></html>
PHP中關(guān)于路徑引用的問(wèn)題,代碼如下,第60行。謝謝各位老師!
有陰影的陽(yáng)光
2018-01-02 22:24:44