php和mysql web開發(fā)外文翻譯_第1頁(yè)
php和mysql web開發(fā)外文翻譯_第2頁(yè)
php和mysql web開發(fā)外文翻譯_第3頁(yè)
php和mysql web開發(fā)外文翻譯_第4頁(yè)
php和mysql web開發(fā)外文翻譯_第5頁(yè)
已閱讀5頁(yè),還剩7頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

英文原文LauraThomson.phpandmysqlwebdevelopLukeWelling,LauraThomson

PHPisascriptinglanguageoriginallydesignedforproducingdynamicwebpages.Ithasevolvedtoincludeacommandlineinterfacecapabilityandcanbeusedinstandalonegraphicalapplications.

WhilePHPwasoriginallycreatedbyRasmusLerdorfin1995,themainimplementationofPHPisnowproducedbyThePHPGroupandservesasthedefactostandardforPHPasthereisnoformalspecification.PHPisfreesoftwarereleasedunderthePHPLicense,howeveritisincompatiblewiththeGNUGeneralPublicLicense(GPL),duetorestrictionsontheusageofthetermPHP.

PHPisawidely-usedgeneral-purposescriptinglanguagethatisespeciallysuitedforwebdevelopmentandcanbeembeddedintoHTML.Itgenerallyrunsonawebserver,takingPHPcodeasitsinputandcreatingwebpagesasoutput.Itcanbemillionwebsitesand1millionwebservers.

PHPoriginallystoodforPersonalHomePage.Itbeganin1994asasetofCommonGatewayInterfacebinarieswrittenintheCprogramminglanguagebytheDanish/GreenlandicprogrammerRasmusLerdorf.LerdorfinitiallycreatedthesePersonalHomePageToolstoreplaceasmallsetofPerlscriptshehadbeenusingtomaintainhispersonalhomepage.Thetoolswereusedtoperformtaskssuchasdisplayinghisrésuméandrecordinghowmuchtraffichispagewasreceiving.HecombinedthesebinarieswithhisFormInterpretertocreatePHP/FI,whichhadmorefunctionality.PHP/FIincludedalargerimplementationfortheCprogramminglanguageandcouldcommunicatewithdatabases,enablingthebuildingofsimple,dynamicwebapplications.LerdorfreleasedPHPpubliclyonJune8,1995toacceleratebuglocationandimprovethecode.ThisreleasewasnamedPHPversion2andalreadyhadthebasicfunctionalitythatPHPhastoday.ThisincludedPerl-likevariables,formhandling,andtheabilitytoembedHTML.ThesyntaxwassimilartoPerlbutwasmorelimited,simpler,andlessconsistent.

ZeevSuraskiandAndiGutmans,twoIsraelidevelopersattheTechnionIIT,rewrotetheparserin1997andformedthebaseofPHP3,changingthelanguage'snametotherecursiveinitialismPHP:HypertextPreprocessor.ThedevelopmentteamofficiallyreleasedPHP/FI2inNovember1997aftermonthsofbetatesting.Afterwards,publictestingofPHP3began,andtheofficiallaunchcameinJune1998.SuraskiandGutmansthenstartedanewrewriteofPHP'score,producingtheZendEnginein1999.TheyalsofoundedZendTechnologiesinRamatGan,Israel.

OnMay22,2000,PHP4,poweredbytheZendEngine1.0,wasreleased.OnJuly13,2004,PHP5wasreleased,poweredbythenewZendEngineII.PHP5includednewfeaturessuchasimprovedsupportforobject-orientedprogramming,thePHPDataObjectsextension(whichdefinesalightweightandconsistentinterfaceforaccessingdatabases),andnumerousperformanceenhancements.ThemostrecentupdatereleasedbyThePHPGroupisfortheolderPHPversion4codebranch.AsofAugust,2008thisbranchisuptoversion4.4.9.PHP4isnolongerunderdevelopmentnorwillanysecurityupdatesbereleased.

In2008,PHP5becametheonlystableversionunderdevelopment.LatestaticbindinghasbeenmissingfromPHPandwillbeaddedinversion5.3.PHP6isunderdevelopmentalongsidePHP5.Majorchangesincludetheremovalofregister_globals,magicquotes,andsafemode.Thereasonfortheremovalswasbecauseregister_globalshadgivenwaytosecurityholes,andmagicquoteshadanunpredictablenature,andwasbestavoided.Instead,toescapecharacters,magicquotesmaybesubstitutedwiththeaddslashes()function,ormoreappropriatelyanescapemechanismspecifictothedatabasevendoritselflikemysql_real_escape_string()forMySQL.

PHPdoesnothavecompletenativesupportforUnicodeormultibytestrings;UnicodesupportwillbeincludedinPHP6.ManyhighprofileopensourceprojectsceasedtosupportPHP4innewcodeasofFebruary5,2008,duetotheGoPHP5initiative,providedbyaconsortiumofPHPdeveloperspromotingthetransitionfromPHP4toPHP1397Itrunsinboth32-bitand64-bitenvironments,butonWindowstheonlyofficialdistributionis32-bit,requiringWindows32-bitcompatibilitymodetobeenabledwhileusingIISina64-bitWindowsenvironment.Thereisathird-partydistributionavailablefor64-bitWindows.

PHPisageneral-purposescriptinglanguagethatisespeciallysuitedforwebdevelopment.PHPgenerallyrunsonawebserver,takingPHPcodeasitsinputandcreatingwebpagesasoutput.Itcanalsobeusedforcommand-linescriptingandclient-sideGUIapplications.PHPcanbedeployedonmostwebservers,manyoperatingsystemsandplatforms,andcanbeusedwithmanyrelationaldatabasemanagementsystems.Itisavailablefreeofcharge,andthePHPGroupprovidesthecompletesourcecodeforuserstobuild,customizeandextendfortheirownuse.

PHPprimarilyactsasafilter,takinginputfromafileorstreamcontainingtextand/orPHPinstructionsandoutputsanotherstreamofdata;mostcommonlytheoutputwillbeHTML.Itcanautomaticallydetectthelanguageoftheuser.FromPHP4,thePHPparsercompilesinputtoproducebytecodeforprocessingbytheZendEngine,givingimprovedperformanceoveritsinterpreterpredecessor.

Originallydesignedtocreatedynamicwebpages,PHP'sprincipalfocusisserver-sidescripting,anditissimilartootherserver-sidescriptinglanguagesthatprovidedynamiccontentfromawebservertoaclient,suchasMicrosoft'sActiveServerPages,SunMicrosystems'JavaServerPages,andmod_perl.PHPhasalsoattractedthedevelopmentofmanyframeworksthatprovidebuildingblocksandadesignstructuretopromoterapidapplicationdevelopment(RAD).SomeoftheseincludeCakePHP,Symfony,CodeIgniter,andZendFramework,offeringfeaturessimilartootherwebapplicationframeworks.

TheLAMParchitecturehasbecomepopularinthewebindustryasawayofdeployingwebapplications.PHPiscommonlyusedasthePinthisbundlealongsideLinux,ApacheandMySQL,althoughthePmayalsorefertoPythonorPerl.

AsofApril2007,over20millionInternetdomainswerehostedonserverswithPHPinstalled,andPHPwasrecordedasthemostpopularApachemodule.SignificantwebsitesarewritteninPHPincludingtheuser-facingportionofFacebook,Wikipedia,PHPcanbeusedtocreatestand-alone,compiledapplicationsandlibraries,itcanbeusedforshellscripting,andthePHPbinariescanbecalledfromthecommandline.

Aswithmanyscriptinglanguages,PHPscriptsarenormallykeptashuman-readablesourcecode,evenonproductionwebservers.Inthiscase,PHPscriptswillbecompiledatruntimebythePHPengine,whichincreasestheirexecutiontime.PHPscriptsareabletobecompiledbeforeruntimeusingPHPcompilersaswithotherprogramminglanguagessuchasC(thelanguagePHPanditsextensionsarewrittenin).

Codeoptimizersaimtoreducethecomputationalcomplexityofthecompiledcodebyreducingitssizeandmakingotherchangesthatcanreducetheexecutiontimewiththeoverallgoalofimprovingperformance.ThenatureofthePHPcompilerissuchthatthereareoftenopportunitiesforcodeoptimization,andanexampleofacodeoptimizeristheZendOptimizerPHPextension.

AnotherapproachforreducingoverheadforhighloadPHPserversisusingPHPaccelerators.ThesecanoffersignificantperformancegainsbycachingthecompiledformofaPHPscriptinsharedmemorytoavoidtheoverheadofparsingandcompilingthecodeeverytimethescriptruns.

TheNationalVulnerabilityDatabasestoresallvulnerabilitiesfoundincomputersoftware.TheoverallproportionofPHP-relatedvulnerabilitiesonthedatabaseamountedto:12%in2003,20%in2004,28%in2005,43%in2006,36%in2007,and35%in2008.MostofthesePHP-relatedvulnerabilitiescanbeexploitedremotely:theyallowhackerstostealordestroydatafromdatasourceslinkedtothewebserver(suchasanSQLdatabase),sendspamorcontributetoDOSattacksusingmalware,whichitselfcanbeinstalledonthevulnerableservers.

Thesevulnerabilitiesarecausedmostlybynotfollowingbestpracticeprogrammingrules:technicalsecurityflawsofthelanguageitselforofitscorelibrariesarenotfrequent.Recognizingthatprogrammerscannotbetrusted,somelanguagesincludetaintcheckingtodetectautomaticallythelackofinputvalidationwhichinducesmanyissues.SuchafeatureisbeingdevelopedforPHP.AlthoughitmaybeincludedinmainstreamPHPinafuturerelease,itsinclusionhasbeenrejectedseveraltimesinthepast.

HostingPHPapplicationsonaserverrequiresacarefulandconstantattentiontodealwiththesesecurityrisks.ThereareadvancedprotectionpatchessuchasSuhosinandHardening-Patch,especiallydesignedforwebhostingenvironments.InstallingPHPasaCGIbinaryratherthanasanApachemoduleisthepreferredmethodforaddedsecurity.

Withrespecttosecuringthecodeitself,PHPcodecanbeobfuscatedtomakeitdifficulttoreadwhileremainingfunctional.

Syntax-highlightedPHPcodeembeddedwithinHTMLPHPonlyparsescodewithinitsdelimiters.AnythingoutsideitsdelimitersissentdirectlytotheoutputandisnotparsedbyPHP.Themostcommondelimitersare<?phpand?>,whichareopenandclosedelimitersrespectively.<scriptlanguage="php">and</script>delimitersarealsoavailable.ShorttagscanbeusedtostartPHPcode,<?or<?=(whichisusedtoechobackastringorvariable)andthetagtoendPHPcode,?>.Thesetagsarecommonlyused,butlikeASP-styletags(<%or<%=and%>),theyarelessportableastheycanbedisabledinthePHPconfiguration.Forthisreason,theuseofshorttagsandASP-styletagsisdiscouraged.ThepurposeofthesedelimitersistoseparatePHPcodefromnon-PHPcode,includingHTML.

Variablesareprefixedwithadollarsymbolandatypedoesnotneedtobespecifiedinadvance.Unlikefunctionandclassnames,variablenamesarecasesensitive.Bothdouble-quoted("")andheredocstringsallowtheabilitytoembedavariable'svalueintothestring.PHPtreatsnewlinesaswhitespaceinthemannerofafree-formlanguage(exceptwheninsidestringquotes),andstatementsareterminatedbyasemicolon.PHPhasthreetypesofcommentsyntax:/**/servesasblockcomments,and//aswellas#areusedforinlinecomments.TheechostatementisoneofseveralfacilitiesPHPprovidestooutputtext(e.g.toawebbrowser).

Intermsofkeywordsandlanguagesyntax,PHPissimilartomosthighlevellanguagesthatfollowtheCstylesyntax.Ifconditions,forandwhileloops,andfunctionreturnsaresimilarinsyntaxtolanguagessuchasC,C++,JavaandPerl.

PHPstoreswholenumbersinaplatform-dependentrange.Thisrangeistypicallythatof32-bitsignedintegers.Unsignedintegersareconvertedvaluesincertainsituations;thisbehaviorisdifferentfromotherprogramminglanguages.Integervariablescanbeassignedusingdecimal(positiveandnegative),octal,andhexadecimalnotations.Floatingpointnumbersarealsostoredinaplatform-specificrange.Theycanbespecifiedusingfloatingpointnotation,ortwoformsofscientificnotation.PHPhasanativeBooleantypethatissimilartothenativeBooleantypesinJavaandC++.UsingtheBooleantypeconversionrules,non-zerovaluesareinterpretedastrueandzeroasfalse,asinPerlandC++.Thenulldatatyperepresentsavariablethathasnovalue.TheonlyvalueinthenulldatatypeisNULL.Variablesofthe"resource"typerepresentreferencestoresourcesfromexternalsources.Thesearetypicallycreatedbyfunctionsfromaparticularextension,andcanonlybeprocessedbyfunctionsfromthesameextension;examplesincludefile,image,anddatabaseresources.ArrayscancontainelementsofanytypethatPHPcanhandle,includingresources,objects,andevenotherarrays.Orderispreservedinlistsofvaluesandinhasheswithbothkeysandvalues,andthetwocanbeintermingled.PHPalsosupportsstrings,whichcanbeusedwithsinglequotes,doublequotes,orheredocsyntax.

TheStandardPHPLibrary(SPL)attemptstosolvestandardproblemsandimplementsefficientdataaccessinterfacesandclasses.

PHPhashundredsofbasefunctionsandthousandsmoreviaextensions.ThesefunctionsarewelldocumentedonthePHPsite,butunfortunately,thebuilt-inlibraryhasawidevarietyofnamingconventionsandinconsistencies.PHPcurrentlyhasnofunctionsforthreadprogramming.

Functionsarenotfirst-classfunctionsandcanonlybereferencedbytheirname--directlyordynamicallybyavariablecontainingthenameofthefunction.User-definedfunctionscanbecreatedatanytimewithoutbeingprototyped.Functionscanbedefinedinsidecodeblocks,permittingarun-timedecisionastowhetherornotafunctionshouldbedefined.Functioncallsmustuseparentheses,withtheexceptionofzeroargumentclassconstructorfunctionscalledwiththePHPnewoperator,whereparenthesesareoptional.PHPsupportsquasi-anonymousfunctionsthroughthecreate_function()function,althoughtheyarenottrueanonymousfunctionsbecauseanonymousfunctionsarenameless,butfunctionscanonlybereferencedbyname,orindirectlythroughavariable$function_name();,inPHP.

PHPgainedsupportforfirst-classfunctionsandclosures.Trueanonymousfunctionsaresupportedusingthefollowingsyntax:

functiongetAdder($x)

{

returnfunction($y)use($x){

return$x+$y;

};

}$adder=getAdder(8);

echo$adder(2);//prints"10"

Here,getAdder()functioncreatesaclosureusingparameter$x(keyword"use"forcesgettingvariablefromcontext),which,etc.FormoredetailsseeLambdafunctionsandclosuresRFC.

Basicobject-orientedprogrammingfunctionalitywasaddedinPHP3andimprovedinPHP4.[3]ObjecthandlingwascompletelyrewrittenforPHP5,expandingthefeaturesetandenhancingperformance.InpreviousversionsofPHP,objectswerehandledlikeprimitivetypes.Thedrawbackofthismethodwasthatthewholeobjectwascopiedwhenavariablewasassignedorpassedasaparametertoamethod.Inthenewapproach,objectsarereferencedbyhandle,andnotbyvalue.PHP5introducedprivateandprotectedmembervariablesandmethods,alongwithabstractclassesandfinalclassesaswellasabstractmethodsandfinalmethods.Italsointroducedastandardwayofdeclaringconstructorsanddestructors,similartothatofotherobject-orientedlanguagessuchasC++,andastandardexceptionhandlingmodel.Furthermore,PHP5addedinterfacesandallowedformultipleinterfacestobeimplemented.Therearespecialinterfacesthatallowobjectstointeractwiththeruntimesystem.ObjectsimplementingArrayAccesscanbeusedwitharraysyntaxandobjectsimplementingIteratororIteratorAggregatecanbeusedwiththeforeachlanguageconstruct.Thereisnovirtualtablefeatureintheengine,sostaticvariablesareboundwithanameinsteadofareferenceatcompiletime.

Ifthedevelopercreatesacopyofanobjectusingthereservedwordclone,theZendenginewillcheckifa__clone()methodhasbeendefinedornot.Ifnot,itwillcalladefault__clone()whichwillcopytheobject'sproperties.Ifa__clone()methodisdefined,thenitwillberesponsibleforsettingthenecessarypropertiesinthecreatedobject.Forconvenience,theenginewillsupplyafunctionthatimportsthepropertiesofthesourceobject,sothattheprogrammercanstartwithaby-valuereplicaofthesourceobjectandonlyoverridepropertiesthatneedtobechanged.

PHPincludesfreeandopensourcelibrarieswiththecorebuild.PHPisafundamentallyInternet-awaresystemwithmodulesbuiltinforaccessingFTPservers,manydatabaseservers,embeddedSQLlibrariessuchasembeddedPostgreSQL,MySQLandSQLite,LDAPservers,andothers.ManyfunctionsfamiliartoCprogrammerssuchasthoseinthestdiofamilyareavailableinthestandardPHPbuild.PHPhastraditionallyusedfeaturessuchas"magic_quotes_gpc"and"magic_quotes_runtime"whichattempttoescapeapostrophes(')andquotes(")instringsintheassumptionthattheywillbeusedindatabases,topreventSQLinjectionattacks.Thisleadstoconfusionoverwhichdataisescapedandwhichisnot,andtoproblemswhendataisnotinfactusedasinputtoadatabaseandwhentheescapingusedisnotcompletelycorrect.[68]Tomakecodeportablebetweenserverswhichdoanddonotusemagicquotes,developerscanprefacetheircodewithascripttoreversetheeffectofmagicquoteswhenitisapplied.

PHPallowsdeveloperstowriteextensionsinCtoaddfunctionalitytothePHPlanguage.ThesecanthenbecompiledintoPHPorloadeddynamicallyatruntime.ExtensionshavebeenwrittentoaddsupportfortheWindowsAPI,processmanagementonUnix-likeoperatingsystems,multibytestrings(Unicode),cURL,andseveralpopularcompressionformats.SomemoreunusualfeaturesincludeintegrationwithInternetRelayChat,dynamicgenerationofimagesandAdobeFlashcontent,andevenspeechsynthesis.ThePHPExtensionCommunityLibrary(PECL)projectisarepositoryforextensionstothePHPlanguage.ZendprovidesacertificationexamforprogrammerstobecomecertifiedPHPdevelopers.英文翻譯php和mysqlweb開發(fā)PHP是一種腳本語(yǔ)言,最初用于生產(chǎn)動(dòng)態(tài)網(wǎng)頁(yè)設(shè)計(jì)。它已發(fā)展到包括一個(gè)命令行界面的能力,可以在獨(dú)立的圖形應(yīng)用程序中使用。

雖然PHP最初由RasmusLerdorf創(chuàng)建于1995年,PHP的主要執(zhí)行現(xiàn)所產(chǎn)生的PHP集團(tuán)和PHP的事實(shí)上的標(biāo)準(zhǔn)服務(wù),因?yàn)闆]有正式的規(guī)范。PHP是PHP的免費(fèi)軟件許可證下發(fā)布的,但它是用GNU通用公共許可證(GPL),由于對(duì)長(zhǎng)期PHP的使用限制不相容的。

PHP是一種廣泛使用的通用目的腳本語(yǔ)言,特別適合于Web開發(fā),可嵌入到HTML中。它通常運(yùn)行在Web服務(wù)器上,以它的輸入PHP代碼和創(chuàng)建作為輸出的網(wǎng)頁(yè)。它可以部署在大多數(shù)網(wǎng)絡(luò)服務(wù)器和幾乎所有的操作系統(tǒng)和平臺(tái)免費(fèi)的。

PHP的最初主張個(gè)人主頁(yè)。它于1994年開始作為一個(gè)通用網(wǎng)關(guān)接口在C編程語(yǔ)言編寫的,由丹麥/格陵蘭程序員拉斯穆斯Lerdorf二進(jìn)制文件集。Lerdorf最初創(chuàng)建這些個(gè)人主頁(yè)工具,以取代一小部分的Perl腳本,他一直在使用,以維持他的個(gè)人主頁(yè)。這些工具用于執(zhí)行任務(wù),如他的履歷和記錄顯示多少流量接受他的頁(yè)面。他結(jié)合自己解釋這些二進(jìn)制文件形式創(chuàng)建的PHP/FI的,其中有更多的功能。PHP/FI的包括一個(gè)較大的C編程語(yǔ)言可以溝通,執(zhí)行和數(shù)據(jù)庫(kù),使簡(jiǎn)單的,動(dòng)態(tài)Web應(yīng)用程序的建設(shè)。Lerdorf公開發(fā)表的PHP6月8日,1995年加快錯(cuò)誤的位置,提高code.This釋放被命名為PHP版本2,已經(jīng)基本功能,PHP有今天。這包括類似Perl的變量,表格處理,以及對(duì)嵌入網(wǎng)頁(yè)的能力。其語(yǔ)法類似Perl的,但比較有限,簡(jiǎn)單,不太一致。

ZeevSuraski和AndiGutmans提及,兩個(gè)從Technion以色列個(gè)人所得稅開發(fā)商,改寫了1997年的分析器,形成了PHP3的基礎(chǔ),改變了語(yǔ)言的名稱遞歸縮寫的PHP:HypertextPreprocessor的。開發(fā)團(tuán)隊(duì)在1997年11月正式發(fā)布的beta測(cè)試后幾個(gè)月的PHP/FI2移植。后來(lái),PHP3的公開測(cè)試開始,而在1998年6月正式推出來(lái)。Suraski和古特曼斯然后開始了PHP的核心新的重寫,在1999年生產(chǎn)了Zend引擎。他們還創(chuàng)辦于拉馬特甘,以色列Zend技術(shù)。

5月22日,2000年,PHP4的Zend引擎1.0的動(dòng)力,被釋放。7月13日,2004年,PHP5的發(fā)布,由新的Zend引擎第二供電。PHP5中包括諸如面向?qū)ο缶幊谈倪M(jìn)支持新的功能,PHP數(shù)據(jù)對(duì)象擴(kuò)展(定義用于訪問(wèn)數(shù)據(jù)庫(kù)的輕量級(jí)和一致的接口),和許多性能增強(qiáng)。最近更新的PHP集團(tuán)發(fā)布的是舊版本的PHP4中的代碼分支。截至2008年8月,這個(gè)分公司是最多的版本4.4.9。PHP4是沒有根據(jù)的發(fā)展也不會(huì)再釋放任何安全更新2008年,PHP5中成為唯一穩(wěn)定的版本正在開發(fā)。晚靜態(tài)綁定已經(jīng)失蹤,并會(huì)從PHP5.3版本中加入。正在旁邊的PHP6的PHP5的發(fā)展。主要變化包括register_globals的搬遷,魔術(shù)引號(hào),和安全模式。為清除的原因是因?yàn)橐呀?jīng)讓register_globals的安全漏洞,和魔術(shù)引號(hào)有一個(gè)不可預(yù)測(cè)性,并最好能避免。相反,為了躲避字符,可能會(huì)取代魔術(shù)引號(hào)與addslashes()函數(shù),或者更恰當(dāng)?shù)奶右輽C(jī)制的特定于數(shù)據(jù)庫(kù)廠商MySQL的本身像mysql_real_escape_string()。

PHP不具備完整的多字節(jié)字符串的Unicode或本地支持;Unicode支持在PHP6將包括在內(nèi)。許多備受矚目的開放源碼項(xiàng)目停止支持在新代碼為2008年2月5日,由于GoPHP5倡議,由一個(gè)PHP開發(fā)人員提供促進(jìn)財(cái)團(tuán)從PHP4到PHP5過(guò)渡PHP4中。

它運(yùn)行在32位和64位環(huán)境,但在Windows的唯一官方分布是32位,需要Windows32位兼容模式下才能啟用,而使用64位Windows環(huán)境IIS的。有一個(gè)第三方的分布為64位Windows操作系統(tǒng)。

PHP是一種通用的腳本語(yǔ)言,特別適合于Web開發(fā)。一般的PHP運(yùn)行在Web服務(wù)器上,以它的輸入PHP代碼和創(chuàng)建作為輸出的網(wǎng)頁(yè)。系數(shù)據(jù)庫(kù)管理系統(tǒng)中使用。它是免費(fèi)提供的,和PHP集團(tuán)提供完整的源代碼,以供用戶建立,定制和擴(kuò)展自己使用。

PHP的主要是作為一個(gè)過(guò)濾器,以從文件或流包含文本和/或PHP的說(shuō)明和產(chǎn)出的另一個(gè)數(shù)據(jù)流;最常見的是將HTML輸入輸出。它可以自動(dòng)檢測(cè)用戶的語(yǔ)言。從PHP4,PHP解析器編譯投入,生產(chǎn)加工由Zend引擎的字節(jié)碼,從而在其翻譯的前任更好的性能。

最初旨在創(chuàng)建動(dòng)態(tài)網(wǎng)頁(yè),PHP的主要重點(diǎn)是服務(wù)器端腳本,它是類似于其他服務(wù)器端腳本語(yǔ)言,提供了如微軟的ActiveServerPages中,Sun微系統(tǒng)由網(wǎng)絡(luò)服務(wù)器動(dòng)態(tài)內(nèi)容到客戶端,'JavaServerPages和的mod_perl。PHP中也引起了提供大廈和設(shè)計(jì)結(jié)構(gòu),以促進(jìn)快速應(yīng)用開發(fā)(RAD)許多框架。其中一些包括:使用CakePHP,Symfony的,CI中,和Zend框架提供的功能類似于其他Web應(yīng)用程序框架。

在LAMP架構(gòu)已經(jīng)成為業(yè)界流行的網(wǎng)絡(luò)作為一個(gè)Web應(yīng)用程序的部署方式。PHP是常用的Linux操作系統(tǒng)捆綁在這同時(shí),Apache和MySQL,雖然在P還可以參考Python或Perl作為一個(gè)P。

截至2007年4月,超過(guò)20萬(wàn)個(gè)互聯(lián)網(wǎng)域名被PHP的安裝與服務(wù)器托管,和PHP作為Apache模塊的最流行的記錄。重要的網(wǎng)站是用PHP編寫的,包括Facebook的面向用戶的部分,維基百科(的mediawiki),雅虎,若以流量,Digg的,WordPress和標(biāo)記。除了服務(wù)器端腳本,PHP可以用來(lái)創(chuàng)建獨(dú)立的,編譯的應(yīng)用程序和庫(kù),它可用于shell腳本,和PHP可執(zhí)行文件可以通過(guò)命令行調(diào)用。

正如許多腳本語(yǔ)言,PHP腳本通常保持人類可讀的源代碼,甚至在生產(chǎn)Web服務(wù)器。在這種情況下,PHP腳本將在運(yùn)行時(shí)編譯的PHP引擎,從而增加了他們的執(zhí)行時(shí)間。PHP腳本能夠運(yùn)行之前使用PHP與其他編程語(yǔ)言編譯器編譯(如C語(yǔ)言的擴(kuò)展PHP和書面)。

代碼優(yōu)化器的目標(biāo)是通過(guò)減少它的大小和作出其他改變,可以減少,以期提高業(yè)績(jī)的總體目標(biāo)的執(zhí)行時(shí)間已編譯代碼的計(jì)算復(fù)雜性。在PHP編譯器的性質(zhì)是這樣的:有機(jī)會(huì)經(jīng)常代碼優(yōu)化,以及對(duì)代碼優(yōu)化的例子是Zend的優(yōu)化PHP擴(kuò)展。

另一種為高負(fù)荷減少PHP服務(wù)器開銷的方法是使用PHP加速器。這些可以通過(guò)緩存提供了一個(gè)共享內(nèi)存中的PHP腳本編譯的形式,避免了解析和編譯代碼每次運(yùn)行腳本開銷巨大的性能提升。

國(guó)家漏洞數(shù)據(jù)庫(kù)存儲(chǔ)的所有漏洞中找到電腦軟件。關(guān)于數(shù)據(jù)庫(kù)的PHP相關(guān)漏洞的總比例為:2004年2003年的12%,20%,28%,2005年,43%在2006年,2007年的36%,而在2008年35%。這些PHP相關(guān)漏洞可以被遠(yuǎn)程利用的大多數(shù):他們?cè)试S黑客竊取或破壞有關(guān),如從一個(gè)SQL數(shù)據(jù)庫(kù)的網(wǎng)絡(luò)服務(wù)器(數(shù)據(jù)源的數(shù)據(jù)),發(fā)送垃圾郵件或?qū)е翫OS攻擊使用惡意軟件,它本身可以安裝對(duì)脆弱的服務(wù)器。

這些漏洞是造成大部分由不按最佳實(shí)踐編程規(guī)則:語(yǔ)言本身或它的核心庫(kù)技術(shù)的安全漏洞并不頻繁。認(rèn)識(shí)到程序員不能信任,一些語(yǔ)言包括污點(diǎn)檢查自動(dòng)檢測(cè)輸入驗(yàn)證誘使許多問(wèn)題缺乏。這種特性是正在開發(fā)的PHP。雖然它可能會(huì)在主流的PHP包括在將來(lái)的版本中,將其列入被駁回,在過(guò)去的好幾倍。

托管服務(wù)器上的PHP應(yīng)用程序需要小心處理,并經(jīng)常注意這些安全風(fēng)險(xiǎn)。有先進(jìn)的防護(hù)補(bǔ)丁,如Suhosin的硬化,修補(bǔ),特別是網(wǎng)站主機(jī)的環(huán)境設(shè)計(jì)。安裝,而不是作為一個(gè)以Apache模塊的CGI二進(jìn)制PHP是為增加安全性的首選方法。

關(guān)于確保代碼本身,PHP的代碼可以模糊處理,使其難以閱讀,而其余的功能。語(yǔ)法突出顯示PHP代碼嵌入內(nèi)HTMLPHP只解析其內(nèi)部分隔符碼。定界符之外的任何直接發(fā)送到輸出,而不是由PHP解析。最常見的分隔符<?php和?>,而“分別是開放和關(guān)閉定界符。<scriptlanguage="php">和“</腳本>分隔符也可提供。短標(biāo)記可用于啟動(dòng)PHP代碼,<?或“<=(這是用來(lái)回顯一個(gè)字符串或變量)和標(biāo)記結(jié)束PHP代碼,?>。這些標(biāo)簽是常用的,但像ASP風(fēng)格標(biāo)記(<%或“<%=和%>),但移植性較差,因?yàn)樗麄兛梢栽赑HP配置禁用。基于這個(gè)原因,短標(biāo)記和ASP風(fēng)格的標(biāo)記不鼓勵(lì)使用。這些分隔符來(lái)分隔PHP的目的是從非PHP代碼,包括HTML代碼。

變量的前綴為1美元的象征和類型不需要事先指定。不同的功能和類名,變量名是大小寫敏感的。這兩個(gè)雙引號(hào)(“”)和定界符字符串允許的能力嵌入到字符串變量的值。PHP的對(duì)待,除非引號(hào)內(nèi)的字符串),并聲明是由一個(gè)分號(hào)終止在一個(gè)自由格式

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論