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ÖÐ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 ......
ÒÔÏÂΪʮ¸öĿǰ×îÁ÷ÐеĻùÓÚMVCÉè¼ÆÄ£Ê½µÄPHP¿ò¼Ü¡£
1. Yii
YiiÊÇÒ»¸ö»ùÓÚ×é¼þµÄ¸ßÐÔÄܵÄPHPµÄ¿ò¼Ü£¬ÓÃÓÚ¿ª·¢´ó¹æÄ£WebÓ¦Óá£Yii²ÉÓÃÑϸñµÄOOP±àд£¬²¢ÓÐ×ÅÍêÉÆµÄ¿âÒýÓÃÒÔ¼°È«ÃæµÄ½Ì³Ì¡£´ÓMVC£¬DAO/ActiveRecord£¬widgets£¬caching£¬µÈ¼¶Ê½RBAC£¬Web·þÎñ£¬µ½Ö÷Ì廯£¬I18NºÍL10N£¬YiiÌṩÁ˽ñÈÕWeb 2.0Ó¦Óÿª·¢ËùÐèÒªµÄ¼¸ ......
[תÌù] Õ¥¸É PHP,²»µÃ²»×ªµÄһƪPHPʹÓü¼ÇÉ!
ÕâÆªÔÓÎÄ·ÒëÕûÀí×ÔÍøÂç¸÷·Îĵµ×ÊÁÏ(¼û×îÄ©µÄ²Î¿¼×ÊÁÏ)£¬ÓÈÆäÊÇ Ilia Alshanetsky (Åå·þÖ®ÖÁ) ÔÚ¶à¸ö PHP »áÒéÉϵÄÑݽ²£¬Ö÷ÒªÊǸ÷ÀàÌá¸ß PHP ÐÔÄܵļ¼ÇÉ¡£ÎªÇó¾«×¼£¬ºÜ¶à²¿·Ö¶¼ÓÐÏêϸµÄЧÂÊÊý¾Ý£¬ÒÔ¼°¶ÔÓ¦µÄ°æ±¾µÈµÈ¡£ÍµÀÁ£¬Êý¾Ý¾Í²»Ò»Ò»¸ø³öÁË£¬Ö±½Ó¸ø½áÂÛ£¬Èç¹ûÐèÒª¿´ÔÎ ......
<?php
error_reporting(0);//7all,0no
ini_set('display_errors', '0');
function myerror($errno, $errstr, $errfile, $errline)
{
echo "<BR>error type: [$errno] $errstr<br />\n";
echo "in line $errline of file $errfile<BR>";
} ......