易截截图软件、单文件、免安装、纯绿色、仅160KB

php删除文件


如何用php删除文件呢?
php中有个函数叫作unlink。只要一个参数,表示文件路径就行了。
bool unlink ( string filename)
成功删除返回真,否则返回假。
这次我在项目中,需要用到删除文件操作。为了完美的操作,首先要判断一下这个路径的文件是否存在,用file_exists函数。如若存在,则去删除文件。具体代码如下:
if(file_exists($aurls[$i])){
   unlink($aurls[$i]);
  }
其中$aurl[$i]一看就知道是在循环中的一个数组。哈哈,没错,我将所要删除的多个文件的路径存到一个数组中,然后遍历。如果文件存在呢,就删除之。为了更有成就感,我在前后加了两句话,变成了这样:
echo "正在删除".$aurls[$i]."……<br />";
  if(file_exists($aurls[$i])){
   unlink($aurls[$i]);
  }
  echo "成功删除".$aurls[$i]."<hr />";
这样结果就好看了,能明确地看到程序执行结果。


相关文档:

php Mod rewrite test

In the directory where you plan to install Elgg, do the following:
Create the file .htaccess and add these two lines
RewriteEngine on
RewriteRule ^testing.php$ modrewrite.php
This tells the webserver to load modrewrite.php when testing.php is
requested.
In order to get this test to work on ......

[转]PHP分页显示制作详细讲解


<!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"\@宋体" ......

BDB官方给PHP提供的接口的程序员真是不负责

刚写完前面的日志,又发现一个Bug:
根据Oracle官方提供的说明:
http://www.oracle.com/technology/documentation/berkeley-db/db/programmer_reference/ext_php.html
class Db4的声明如下:
class Db4 {
function Db4($dbenv = null) {} // create a new Db4 object using
......

如何将php获得的时间转换为北京时间

从php5.10开始,php中加入了时区的设置,在php中显示的时间都是格林威治标准时间,这就造成了我们中国的用户会差八个小时的问题!
相关设置是修改php.ini中的 date.timezone 参数:
[Date]
; Defines the default timezone used by the date functions
;date.timezone =
默认是关闭的,只需把注释去掉,改为即可
[Dat ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号