Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

玻璃屋女孩、茄子妹妹帮我看看我写的计划任务怎么没用

[复制链接]
ntserver 发表于 2010-2-6 01:41:17 | 显示全部楼层 |阅读模式
本帖最后由 ntserver 于 2010-02-06 16:52 编辑

如题
我想定时删文件,可是我写的怎么无效,在浏览器中执行是可以的,就是在计划任务无效,代码如下。
  1. <?php






  2. delfileunderdir('../../zj/create');

  3. /*
  4. 用于删除目录
  5. delDirAndFile( '../123/111');

  6. */


  7. //删除文件
  8. function delFileUnderDir( $dirName="../Smarty/templates/templates_c" )
  9. {
  10. if ( $handle = opendir( "$dirName" ) ) {
  11.    while ( false !== ( $item = readdir( $handle ) ) ) {
  12.    if ( $item != "." && $item != ".." ) {
  13.    if ( is_dir( "$dirName/$item" ) ) {
  14.          delFileUnderDir( "$dirName/$item" );
  15.    } else {
  16.    if( unlink( "$dirName/$item" ) )echo "成功删除文件: $dirName/$item<br />\n";
  17.    }
  18.    }
  19.    }
  20.    closedir( $handle );
  21. }
  22. }




  23. /*
  24. 循环删除目录和文件函数
  25. function delDirAndFile( $dirName )
  26. {
  27. if ( $handle = opendir( "$dirName" ) ) {
  28.    while ( false !== ( $item = readdir( $handle ) ) ) {
  29.    if ( $item != "." && $item != ".." ) {
  30.    if ( is_dir( "$dirName/$item" ) ) {
  31.    delDirAndFile( "$dirName/$item" );
  32.    } else {
  33.    if( unlink( "$dirName/$item" ) )echo "成功删除文件: $dirName/$item<br />\n";
  34.    }
  35.    }
  36.    }
  37.    closedir( $handle );
  38.    if( rmdir( $dirName ) )echo "成功删除目录: $dirName<br />\n";
  39. }
  40. }
  41. */

  42. ?>
复制代码
 楼主| ntserver 发表于 2010-2-6 16:52:18 | 显示全部楼层
咋没人给我看嘛
回复

使用道具 举报

 楼主| ntserver 发表于 2010-2-6 20:31:20 | 显示全部楼层
我顶我顶,往死里顶
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-6-18 21:41 , Processed in 0.704032 second(s), 16 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表