/**************php关键语句************************/
<?php
/****************正则规则***************************/
$aa=file_get_contents(“http://www.com04.com/index.html“);
preg_match_all(‘|\<a(.*)([^>]*)\>(.*)\<\/a\>|iU’,$aa,$bb);
print_r($bb[3]);
详细参考本文件夹内的正则参考
/*******************关键词参考*******************/
//查询结果select中取值 mysql_result($qcat,0,”id”);
//最后一个插入值 mysql_insert_id();
//合并数组 array_merge($defaultvar,$_POST);
//判断是否有结果,如果无,做返回一个错误 if(!$_POST[‘id’]) echo mysql_error();
//switch判断 switch($_SERVER[‘QUERY_STRING’]){ case 1: case 2: default: }
//explode分割数组 $_POST[‘cat_sp’] =explode(“|”,$_POST[‘cat_sp’]);
//释放数组 unset($_POST[‘cat_names’][$k]);
mysql_num_rows($qtest)
/**************************循环参考*******************/
//while循环,查询结果叠加
while ($result = mysql_fetch_array($qcatid,MYSQL_ASSOC)){
$row[]=$result;
}
//while循环至固定值法
while($id!=0){
$topcat=mysql_query(“select id,reid from {$c}arctype where id=’$id'”);
$id=mysql_result($topcat,0,”reid”);
$dd=mysql_result($topcat,0,”id”);
}
//foreach循环
foreach ( $_POST as $key => $value ) {
}
//判断值是否在某个数组内
if (!in_array($key,$mfs)){}
/***************************函数参考*********************/
function fenlei($array,$fid =0,$depth=0){
$menu=”;
$tag=”;
$depth++;
for($i=0;$i<count($array);$i++){
if($array[$i][‘reid’]==$fid){
if($depth>1) $tag = str_repeat(“-“,$depth);
$menu.='<option value=”‘.$array[$i][‘id’].'”>’.$tag.$array[$i][‘typename’].'</option>';
$menu.=fenlei($array,$array[$i][‘id’],$depth);
}
}
return $menu;
}
/****************数据库操作****************************/
$conn = mysql_connect($cfg_dbhost,$cfg_dbuser,$cfg_dbpwd) or die(“can not connect to the server!”);
mysql_select_db($cfg_dbname,$conn);
/****************************三个重要的类*******************/
一个是文件处理类filedeal.php
一个是文件替换类replacedeal.php
一个是拼音处理类pinyindeal.php
下载:3vip