我到這一步為什么不能echo出創(chuàng)建的文件?
<?php
require_once 'dir.func.php';
require_once 'file.func.php';
$path="file";//打開名字為“file”的目錄
$info=readDirectory($path);//使用dir.func函數(shù),讀取$path目錄下的內(nèi)容,并且將讀取到的二維數(shù)組內(nèi)容賦值到$info上。
$act=$_REQUEST['act'];
$filename=$_REQUEST['filename'];
if ($act=="createFile"){
? ? echo $path.'--';
? ? echo $filename;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<link href="css/cikonss.css" rel="stylesheet" type="text/css">
<style>div,ul,li{list-style-type:none;margin:0;padding:0;}</style>
<title>在線文件管理</title>
</head>
<body>
<h1>在線文件管理系統(tǒng)</h1>
<div id="top">
<ul il="nav">
<li><span class="icon icon-small icon-square"><span></span></span></li>
<li><span class="icon icon-small icon-square"><span></span></span></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
<table width="100%" cellsapcing="0" border="1" cellpadding="5" bgcolor="#ABCDEF" algin="center">
<tr id="createFolder" style="display:block;">
<td>
<input type="text" name="dirname"/>
<input type="submit" name="act" value="創(chuàng)建文件夾"/>
</td>
</tr>
<!--創(chuàng)建文件夾 -->
<tr id="createFile" style="display:block;">
<td>
<input type="text" name="filename"/>
<input type="hidden" name="path" value="<?php echo $path; ?>" />
<input type="hidden" name="act" value="createFile" />
<input type="submit" value="創(chuàng)建文件"/>
</td>
</tr>
<!-- 創(chuàng)建文件 -->
<tr>
<td>編號(hào)</td>
<td>名稱</td>
<td>類型</td>
<td>大小</td>
<td>可讀</td>
<td>可寫</td>
<td>可執(zhí)行</td>
<td>創(chuàng)建時(shí)間</td>
<td>修改時(shí)間</td>
<td>查看時(shí)間</td>
<td>操作</td>
</tr>
<?php
if ($info['file']){
$i=1;
foreach ($info['file'] as $val){
$p=$path."/".$val;//$path下的$val,$path為目錄,$val為文件。
?>
<tr>
<td><?php echo $i;?></td>
<td><?php echo $val?></td>
<td><?php $src=filetype($p)=="file"?"file_ico.png":"folder_ico.png";?><img src="images/<?php echo $src;?>" alt="" ?title="文件"/></td>
<td><?php echo transByte(filesize($p)); ?></td>
<td><?php $src=is_readable($p)?"correct.png":"error.png";?><img src="images/<?php echo $src;?>" width="30px" height="30px" /></td>
<td><?php $src=is_writable($p)?"correct.png":"error.png";?><img src="images/<?php echo $src;?>" width="30px" height="30px" /></td>
<td><?php $src=is_executable($p)?"correct.png":"error.png";?><img src="images/<?php echo $src;?>" width="30px" height="30px" /></td>
<td><?php echo date("Y-m-d H:i:s",filectime($p));?></td>
<td><?php echo date("Y-m-d H:i:s",filemtime($p));?></td>
<td><?php echo date("Y-m-d H:i:s",fileatime($p));?></td>
</tr>
<?php
$i++;
}
}
?>
</table>
</body>
</html>
2017-07-04
你檢查一下創(chuàng)建目錄對么?