function delsame(&$array)
{
$i = 0;
while(isset($array[$i]))
{
$j = $i + 1;
while(isset($array[$j]))
{
if($array[$i] == $array[$j]) //如果发现后面有重复的元素
{
delmember($array, $j); //把它删除
$j--; //重新检查补上来的元素是否是重复的
}
$j ++;
}
$i ++;
}
}
php删除目录及目录下所有文件子目录
<?php教程
set_time_limit(0);
$filenum=0;
function deldir($dir){
global $filenum;
$dh=opendir($dir);
while ($file=readdir($dh)){
if($file!="."&&$file!=".."){
$fullpath=$dir."/".$file;
if(!is_dir($fullpath)){
unlink($fullpath);
if(($filenum %100)==0){
echo "*";
}
$filenum=$filenum+1;
}else{
deldir($fullpath);
}
}
}
closedir($dh);
}
deldir("/www.phprm.com/");
echo "delete cache file success. total:".$filenum;
?>
php判断远程图片是否存在
function img_exits($http://pic2.phprm.com/2010/08/24/url.jpg)
{
$ch = curl_init();
curl_setopt($ch, curlopt_url,$url);
curl_setopt($ch, curlopt_nobody, 1); // 不下载
curl_setopt($ch, curlopt_failonerror, 1);
curl_setopt($ch, curlopt_returntransfer, 1);
php 用户登录代码
<?
error_reporting(0);
if(isset($_post['post']) && $_post['post']=="1"){
$mysql教程_servername = "localhost";
$mysql_username = "root";
$mysql_password ="";
$mysql_database ="peng";
mysql_connect($mysql_servername , $mysql_username , $mysql_password);
mysql_select_db($mysql_database);
$name=$_post['name'];
$passowrd=$_post['password'];
获取checkbox值的几种方法
比如你的input是这样:
<input type="checkbox" name="menu[1]" value="1">1
<input type="checkbox" name="menu[2]" value="2">2
<input type="checkbox" name="menu[3]" value="3">3
php 中英文混合文本截取字符串函数
方法二
//中文截取2,单字节截取模式
//如果是request的内容,必须使用这个函数
php 查找数组键名并输出值
$q ='www.phprm.com';
$items = array(
"great <em>bittern</em>"=>"botaurus stellaris",
"little <em>grebe</em>"=>"tachybaptus ruficollis",
"black-necked grebe"=>"podiceps教程 nigricollis",
"little bittern"=>"ixobrychus minutus",
"black-crowned night heron"=>"http://www.phprm.com",
"www.phprm.com"=>"ardea purpurea",
"white stork"=>"ciconia ciconia",
"spoonbill"=>"platalea leucorodia",
"red-crested pochard"=>"netta rufina",
"common eider"=>"somateria mollissima",
"red kite"=>"milvus milvus",
"hen harrier"=>"circus cyaneus",
"heuglin's gull"=>"larus heuglini"
);
foreach ($items as $key=>$value) {
if (strpos(strtolower($key), $q) !== false) {
echo "$key|$value ";
}
}
电话号码正则表达式
//js 电话号码正则表达式
服务器运行状况即时显示表
<html><title)服务器运行状况即时显示表</title>
<table border=0><tr><td bgcolor=litered width=100% colspan="9"><p align="center"><b>服务器运行状况即时显示表</b><center>
<?php教程
set_time_limit(0);
echo strftime ("%y 年 %m 月 %d 日. ");
?>
</td></tr>
<tr><td bgcolor="#cococo">ip 地址</td><td bgcolor="#cococo">检测时间</td>
<td bgcolor="#cococo">ftp </td>
<td bgcolor="#cococo">telnet</td><td bgcolor="#cococo">smtp </td>
<td bgcolor="#cococo">dns</td><td bgcolor="#cococo">http </td>
<td bgcolor="cococo">pop3</td><td bgcolor="#cococo">finger </td>
</td></center>
php 判断字符串包含指定字符
//实例一
//实例二
php 日期正则表达式
//日期实例二
?>
php用户登录实例教程代码
error_reporting(0);
$mysql_servername = "localhost";
$mysql_username = "root";
$mysql_password ="";
$mysql_database ="peng";
mysql_connect($mysql_servername , $mysql_username , $mysql_password);
mysql_select_db($mysql_database);
$name=$_post['name'];
$passowrd=$_post['password'];