php ¶ÁÈ¡ÎļþÍ·²¿Á½¸ö×Ö½Ú ÅжÏÎļþµÄʵ¼ÊÀàÐÍ
function checkFileType($fileName){
$file = fopen($fileName, "rb");
$bin = fread($file, 2); //Ö»¶Á2×Ö½Ú
fclose($file);
$strInfo = @unpack("C2chars", $bin);// CΪÎÞ·ûºÅÕûÊý£¬ÍøÉÏËѵ½µÄ¶¼ÊÇc£¬ÎªÓзûºÅÕûÊý£¬ÕâÑù»á²úÉú¸ºÊýÅжϲ»Õý³£
$typeCode = intval($strInfo['chars1'].$strInfo['chars2']);
$fileType = '';
if($typeCode == 255216 /*jpg*/ || $typeCode == 7173 /*gif*/ || $typeCode == 13780 /*png*/) {
return true;
}else{
return false;
}
}
Ïà¹ØÎĵµ£º
PHP]
;;;;;;;;;;;
; WARNING ;
;;;;;;;;;;;
; This is the default settings file for new PHPinstallations.
; By default, PHP installs itself with a configuration suitablefor
; development purposes, and *NOT* for production purposes.
; For several security-oriented considerations that should betak ......
string date ( string format [, int timestamp] ) //ÆäÖÐtimestampΪ¿ÉÑ¡£¬Ä¬ÈÏֵΪtime();
date("1"); //Monday
date("m.d.y"); //12.21.09
date("m.d.Y");//12.21.2009
$tomorrow = mktime(0, 0, 0, date("m") , date("d")+1, date("Y"));
$las ......
1.°Ñ½âѹµÄphp-5.2.6-Win32.zipÖØÃüÃûΪphp5¡£²¢¸´ÖƵ½DÅÌĿ¼Ï¡£¼´°²×°Â·¾¶Îª D:\php5
2.ÕÒµ½phpĿ¼Ï嵀 php.ini-dist»ò php.ini.recommendedÎļþ£¬ÖØÃüÃûΪ php.ini
3.ÔÙ°ÑphpĿ¼ÏµÄphp5ts.dll,libmysql.dll¸´ÖƵ½Ä¿Â¼ c:\windows\system32Ï¡£
4.°Ñphp5\extĿ¼ÏµÄphp_gd2.dll,php_mysql.dll,php_mbstring.dllÎ ......
1£¬¶¨Òåheader()Í·²¿Êä³ö¸ñʽ
header("Content-type:application/vnd.ms-excel");
header("Content-Disposition:finlename=php.xls");
vnd.ms-excel -----¶¨ÒåÊä³öÎļþ¸ñ
php.xls ---------¶¨ÒåÊä³öµÄÎļþÃû
2£¬Êä³ö±à ......
ÕâÊÇÎÒ×î½ü¼¸ÌìµÄѧϰÐĵã¬Óë´ó¼Ò¹²Ïí¡£
1£¬Ò»°ãÇé¿öÏÂÎÒÃÇÓüÇʱ¾Ð´Ò»¸ö¼òµ¥µÄPHPÒ³Ãæ£¬·ÅÔÚApache·þÎñÆ÷°²×°Ä¿Â¼ÏµÄhtdocsĿ¼Ï£¬¼´¿É·ÃÎÊ¡£
Õâʱ£¬ÔÚhttpd.confÎļþÖжÔÓ¦µÄ·þÎñÆ÷¸ùĿ¼ÅäÖÃΪ£ºDocumentRoot "D:/Apache Software Foundation/Apache2.2/htdocs"
Ŀ¼ÅäÖÃΪ£º<Directory "D:/Apache Software F ......