php 创建和删除文件夹
//创建文件夹的方法
//$path 为文件夹参数,如 (c:/program files/makedir)
function createFolders($path) {
if (!file_exists($path)) {
$this->createFolders(dirname($path));
mkdir($path, 0777);
}
}
/////////////////////////
删除文件夹的方法(文件夹里有文件和没有文件都能删除)
function deldir($dir) {
$dh=opendir($dir);
while ($file=readdir($dh)) {
if($file!="." && $file!="..") {
$fullpath=$dir."/".$file;
if(!is_dir($fullpath)) {
unlink($fullpath);
} else {
$this->deldir($fullpath);
}
}
}
closedir($dh);
if(rmdir($dir)) {
return true;
} else {
return false;
}
}
相关文档:
1、mysql_connect()-建立数据库连接 {3RY4HVT?
格式: Fv n:V\eb
resource mysql_connect([string hostname [:port] [:/path/to/socket] [, string username] [, string password]]) _I;+p eq
例: 1(V>8}zn
$conn = @mysql_connect("localhost", "username", "password") or dir(" ......
global定义一个全局变量,这个全局变量不是应用整个网站,而是应用与当前页面(包括require和include文件)文件。
$aa="test";
function test()
{
global $aa;
echo $aa;
}
test(); //print test
函数内定义的变量函数外可以调用,在函数外定义的的变量函数内不能使用。
gl ......
工作中用到,自己写了一个,分享给有需要的人,前面是类定义,后面2行是调用。
优点:
不需要外部图片
支持PNG透明
可自定义圆角半径
不足:
只能指定一种透明色
<?php
class RoundedCorner {
private $_r;
private $_g;
private $_b;
private $_image_path;
private $_radius;
function _ ......
<?php
/*使用文本文件记录数据的简单实现*/
$counter=1;
if(file_exists("mycounter.txt")){
$fp=fopen("mycounter.txt","r");
$counter=fgets($fp,9);
$counter++;
fclose($fp);
}
$fp=fopen("mycounter.txt","w");
fputs($fp,$counter);
fclose($fp);
echo "<h1>您是第".$counter."次访问本页 ......
一、安装系统环境
1、系统:centos5
2、测试在vm5.5
准备软件
lighttpd-1.4.18
下载地址
mysql-5.0.41
part1下载地址
part2下载地址
part3下载地址
php-5.2.3
下载地址
SupeSite/X-Space
part1下载地址
part2下载地址
part3下载地址
discuz
下载地址
二、搭建web服务器安装过程
1、mysql5安装
$ tar zx ......