php³£Óú¯Êý2
Îļþ¶ÁÈ¡º¯Ê½
//Îļþ¶ÁÈ¡º¯Ê½
function PHP_Read($file_name) {
$fd=fopen($file_name,r);
while($bufline=fgets($fd, 4096)){
$buf.=$bufline;
}
fclose($fd);
return $buf;
}
?>
ÎļþдÈ뺯ʽ
//ÎļþдÈ뺯ʽ
function PHP_Write($file_name,$data,$method="w") {
$filenum=@fopen($file_name,$method);
flock($filenum,LOCK_EX);
$file_data=fwrite($filenum,$data);
fclose($filenum);
return $file_data;
}
?>
¾²Ì¬Ò³ÃæÉú³Éº¯Ê½
//¾²Ì¬Ò³ÃæÉú³Éº¯Ê½
function phptohtm($filefrom,$fileto,$u2u=1){
if($u2u==1){
$data=PHP_Read($filefrom);
}else{
$data=$filefrom;
}
PHP_Write($fileto,$data);
return true;
}
?>
Ö¸¶¨Ìõ¼þÐÅÏ¢ÊýÁ¿¼ìË÷º¯Ê½
//Ö¸¶¨Ìõ¼þÐÅÏ¢ÊýÁ¿¼ìË÷º¯Ê½
function rec_exist($table,$where){
$query="select count(*) as num from $table ".$where;
$result=mysql_query($query) or die(nerror(1));
$rowcount=mysql_fetch_array($result);
$num=$rowcount["num"];
if ($num==0){
return false;
}
return $num;
}
?>
Ŀ¼ɾ³ýº¯Ê½
//Ŀ¼ɾ³ýº¯Ê½
function del_DIR($directory){
$mydir=dir($directory);
while($file=$mydir->read()){
if((is_dir("$directory/$file")) AND ($file!=".") AND ($file!="..")){
del_DIR("$directory/$file");
}else{
if(($file!=".") AND ($file!="..")){
unlink("$directory/$file");
//echo "unlink $directory/$file ok ";
}
Ïà¹ØÎĵµ£º
½øÐÐÎļþµÄ¶ÁºÍд£¬ÏÈ´ò¿ªÒ»¸öÎļþ£¬È»ºó¿ªÊ¼¶Á»òÕßдÎļþ£¬×îºóÔÙ¹ØÏµÕâ¸öÎļþ×ÊÔ´¡£
È磬ÎļþµÄ¶Á²Ù×÷£º
<?php
$file = fopen('your file path','r');
while(!feof($file)){ //µ±Ã»ÓжÁÈ¡µ½Îļþ½á⣬¼ÌÐøÑ»·¶ÁÈ¡²Ù×÷
$line = fgets($file); //¶ÁÈ¡µ½Ò»ÐеÄÄÚÈÝ
echo $line.'<br/>';
}
fclose($file) ......
<?php
date_default_timezone_set("Etc/GMT-8");
header("content-type:text/html; charset=utf-8");
/**
* ×Ô¼º¶¨ÒåµÄÒ»¸öÉú³ÉÈÕÀúµÄÀà
* @author ÕÅΰ²Ó<yuanfen860913@163.com>
* @version 1.0.0
*
*/
class myCalendar
{
......
phpÖÐsubstrµÄÓ÷¨Ïê½â
php.netÖйØÓÚsubstrµÄ˵Ã÷ºÜ¼òµ¥:
start
If start is non-negative, the returned string will start at the start 'th position in string , counting from zero. For instance, in the string 'abcdef', the character at position 0 is 'a', the character at position 2 is 'c', and so for ......
<?php
/*
* Created on 2009-10-28
* ·Ö×ÓÈçÃÎo(╯¡õ╰)o
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
interface pusb{
function verson();
  ......
PHPÓкܶà»úÖÆ¡¢º¯Êý£¬Æäʵ¾ÍÊÇħÊõʦ£¬Öظ´·¢»ÓºÃ£¬ÆäʵÉõÖÁÊǼòµ¥Ó¦Ó㬾ͻá³öÏÖÉñÆæµÄЧ¹û¡£ÕâÀï½²Ò»¸öob_start()º¯Êý¡£
ob_start()º¯ÊýÓÃÓÚ´ò¿ª»º³åÇø,±ÈÈçheader()º¯ÊýÖ®
ǰÈç¹û¾ÍÓÐÊä³ö,°üÀ¨»Ø³µ\¿Õ¸ñ\»»ÐÐ\¶¼»áÓДHeader had all ready send
by”µÄ´íÎó,Õâʱ¿ÉÒÔÏÈÓÃob_start()´ò¿ª»º³åÇøPHP´úÂëµÄÊý¾ ......