我到这一步为什么不能echo出创建的文件?

来源:1-5 创建文件

慕粉3513192

2017-06-22 14:20

<?php

require_once 'dir.func.php';

require_once 'file.func.php';

$path="file";//打开名字为“file”的目录

$info=readDirectory($path);//使用dir.func函数,读取$path目录下的内容,并且将读取到的二维数组内容赋值到$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>在线文件管理系统</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="创建文件夹"/>

</td>

</tr>

<!--创建文件夹 -->

<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="创建文件"/>

</td>

</tr>

<!-- 创建文件 -->

<tr>

<td>编号</td>

<td>名称</td>

<td>类型</td>

<td>大小</td>

<td>可读</td>

<td>可写</td>

<td>可执行</td>

<td>创建时间</td>

<td>修改时间</td>

<td>查看时间</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>


写回答 关注

1回答

  • qq_KungfuPander_0
    2017-07-04 16:13:50

    你检查一下创建目录对么?

WEB在线文件管理器

通过本课程文件目录函数库的学习,让你掌握文件、目录函数库的应用

36207 学习 · 332 问题

查看课程

相似问题