通过使用标准的和可选的扩展模块,php应用程序可以连接mysql或oracle等十几种数据库、绘图、创建pdf文件和创建解析xml文件。你也可以使用c语言来写自己的php扩展模块。例如,在已存在的代码库中提供一个php的接口函数。你也可以在windows下运行php,使用com控制其它诸如word和excel的windows应用程序,或者使用odbc来连接数据库。在国内,php曾经和微软的asp并驾齐驱,是大家常用的网络编程语言。 php上传类代码:
php /** *@packagemyframeworkuploadclass *@descriptionuploadclass *@date2007-11-28 *@authorantsnet *@copyrighthttp://www.antsnet.net *@emailantsnet@163.com *@environment:apache2.0.59+php5.2.5+mysql5.0 *@version$id:myframe_upload.php22008-02-2701:14:05zadministrator$ */ classmyframe_uploadextendsmyframe { var$uploadpath=uploadfile/; var$fullpath=''; var$message; var$_debug=false; var$errormessage=''; function__construct($uploadpath='') { if($uploadpath!=) { $this->uploadpath=$uploadpath; } } /** *batchupload * *@paramarray$arrayoutput */ publicfunctionformlocalbatch($keepsource=false,$arrayoutput='') { $returnarray=array(); if(sizeof($_files)==$arrayoutput&&!$keepsource) { $i=0; foreach($_filesas$index=>$value) { $returnarray[]=$this->fromlocal($value,$outputname[$i]); $i++; } }else{ foreach($_filesas$index=>$value) { $returnarray[]=$this->fromlocal($value); } } return$returnarray; } /** *uploadfileformlocal * *@paramarray|string$file_area_name *@paramarray|string$outputname */ publicfunctionfromlocal($value,$outputname='') { include_once(serverroot.myframe.'myframe_basic.php'); /** *thefollowingforsingle */ if($outputname==''||$outputname==null) { $outputname=date(ymdhis); } if($value['error']>0) { switch($value['errror']) { case'1': $this->errormessage[]=$this->myframemessage['false']['file']['max']; returnfalse; break; case'2': $this->errormessage[]=$this->myframemessage['false']['file']['maxdefined']; returnfalse; break; case'3': $this->errormessage[]=$this->myframemessage['false']['file']['uncomplite']; returnfalse; break; case'4': $this->errormessage[]=$this->myframemessage['false']['file']['unupload']; returnfalse; break; } } $filename=$this->uploadpath.$outputname.myframe_basic::getfilename($value['name']).myframe_basic::getfileext($value['name']); if(is_uploaded_file($value['tmp_name'])) { if(!move_uploaded_file($value['tmp_name'],$filename)) { $this->errormessage[]=$this->myframemessage['false']['file']['move']; returnfalse; }else{ return$filename; } } } /** *uploadfromnetwork * *@paramarray|string$url *@paramarray|string$outputname *@parambool$keepsource */ publicfunctionfromnet($url,$outputname='',$keepsource=false) { include_once(serverroot.myframe.'myframe_basic.php'); if($outputname==) { $outputname=date(ymdhis); } $filetype=myframe_basic::getfileext($url); $filename=$outputname.$filetype; $contents=file_get_contents($url); $return=file_put_contents($this->uploadpath.$filename,$contents); if($return){ $this->fullpath=$this->uploadpath.$filename; return$this->fullpath; }else{ $this->errormessage[]=$this->myframemessage['false']['file']['url']; returnfalse; } } }
http://www.bkjia.com/phpjc/446547.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/446547.htmltecharticlephp上传类还是比较常用的,于是我研究了一下php上传类,在这里拿出来和大家分享一下,希望对大家有用。php本身是一种简单而强大的语言...
