毕设外文翻译.docx
《毕设外文翻译.docx》由会员分享,可在线阅读,更多相关《毕设外文翻译.docx(9页珍藏版)》请在冰点文库上搜索。
西安邮电大学
毕业设计(外文翻译)
题目:
DesignandImplementationoftheWebsiteBasedonPHP&MYSQL
基于PHP和MYSQL的网站设计和实现
学院:
计算机学院
专业:
网络工程
班级:
网络1101
学生姓名:
周从军
导师姓名:
朱辉职称:
讲师
Abstract
PHPandMYSQLhasbeenthemainwebdevelopmenttoolforitisfreeandopensource.TheauthorshavediscussedtheenvironmentalissuesindevelopmentprocessbasedonPHPandMYSQLandtheimplementationprocessofthewebsite.KeywordsPHP;MYSQL;DevelopmentandImplementation.
1.INTRODUCTION
WiththedevelopmentofWebtechnology,itisinevitablechoiceforallkindofcorporategrowthtocombinetraditionalmarketingwithnetworkmarketing.Theeffectivemethodofnetworkmarketingistoestablishthewebsitewhichissuitablefortheircompany.Atpresentthewebsitedevelopment'smainstreamplatformincludes:
LAMP(Linuxoperatingsystem,Apachenetworkserver,MYSQLdatabase,PHPprogramminglanguage),J2EEand.Netcommercialsoftware.BecausePHPandMYSQLisfree,opensourceandsoon,theyarenotedforITprofessionals.Fromtheperspectiveofwebsitetraffic,morethan70%ofwebsitetrafficisprovidedwithLAMP,whichismostpopularplatformfordevelopingthewebsite.Inthispaper,wedesignedawebsitebasedonPHPandMYSQL.Thepaperisorganizedasfollows.Section1makeconclusionInSection5.
2.DEVELOPMENTENVIRONMENTANALYSIS
A.TheChoiceofDevelopmentLanguage
ASP.NET,PHP&JSParethreemainstreamlanguagesofthewebsitedevelopment,whichhavetheiradvantagesanddisadvantagesrespectively,thecomparisonbetweenthemisshowninTable1.TheprojecttakesPHPasthedevelopmentlanguage,thereasonisasfollows:
•Free.Theprojectissmall,whichisnoneedtousethepaymentdevelopmentplatformsuchasASP.NETandJSP.•Strongsupporting.Middleandsmallscalewebsites,evensomelarge-scalewebsitessuchasbaidu,SinainChinatakePHPasthedevelopmentlanguage,whichcancontributetosolvetheproblemduringtheprogramming.analyzesdevelopmentenvironment.InSection2,weproposedthedevelopmentmodelbasedonPHP.ThencasestudyinSection4.we
•Goodportability.AlthoughitisdesignedtouseintheenvironmentofLinuxandApacheWebserversystematfirst,nowPHPisalreadytransplantedanyoperatingsystemandcompatiblestandardWebserversoftware.•Simplegrammar.PHPhasmanysimilaritieswiththeCprogramminglanguage,soitiseasytoprogramusingPHPfortheCprogrammers.•Rapiddevelopment.Becausethesourcecodeisopen,PHPwillcontinuetodeveloprapidly.
WhenZeevSuraskiaddedtheobject-orientedsyntaxbackinthedaysofPHP3,itwasaddedas"syntacticsugarforaccessingcollections."TheOOmodelalsohadsupportforinheritanceandallowedaclass(andobject)toaggregatebothmethodsandproperties,butnotmuchmore.WhenZeevandAndiGutmansrewrotethescriptingengineforPHP4,itwasacompletelynewengine;itranmuchfaster,wasmorestable,andboastedmorefeatures.However,theOOmodelfirstintroducedinPHP3wasbarelytouched.Althoughtheobjectmodelhadseriouslimitations,itwasusedextensivelyaroundtheworld,ofteninlargePHPapplications.ThisimpressiveuseoftheOOPparadigmwithPHP4,despiteitsweaknesses,ledtoitbeingthemainfocusforthePHP5release.So,whatweresomeofthelimitationsinPHP3and4?
Thebiggestlimitation(whichledtofurtherlimitations)wasthefactthatthecopysemanticsofobjectswerethesameasfornativetypes.So,howdidthisactuallyaffectthePHPdeveloper?
Whenassigningavariable(thatpointstoanobject)toanothervariable,acopyoftheobjectwouldbecreated.Notonlydidthisimpactperformance,butitalsousuallyledtoobscurebehaviorandbugsinPHP4applicationsbecausemanydevelopersthoughtthatbothvariableswouldpointatthesameobject,whichwasnotthecase.Thevariableswereinsteadpointingatseparatecopiesofthesameobject.Changingonewouldnotchangetheother.Forexample:
classPerson{var$name;functiongetName(){return$this->name;}functionsetName($name){$this->name=$name;}functionPerson($name){$this->setName($name);}}functionchangeName($person,$name){$person->setName($name);}$person=newPerson("Andi");changeName($person,"Stig");print$person->getName();InPHP4,thiscodewouldprintout"Andi".Thereasonisthatwepasstheobject$persontothechangeName()functionby-value,andthus,$personiscopiedandchangeName()worksonacopyof$person.Thisbehaviorisnotintuitive,asmanydeveloperswouldexpecttheJava-likebehavior.InJava,variablesactuallyholdahandle(orpointer)totheobject,andtherefore,whenitiscopied,onlythehandle(andnottheentireobject)isduplicated.ThereweretwokindsofusersinPHP4:
theoneswhowereawareofthisproblemandtheoneswhowerenot.Thelatterwouldusuallynotnoticethisproblemandtheircodewaswrittenina
waywhereitdidnotreallymatteriftheproblemexisted.Surelysomeofthesepeoplehadsleeplessnightstryingtotrackdownweirdbugsthattheycouldnotpinpoint.Theformergroupdealtwiththisproblembyalwayspassingandassigningobjectsbyreference.Thiswouldpreventtheenginefromcopyingtheirobjects,butitwouldbeaheadachebecausethecodeincludednumerous&signs.Theoldobjectmodelnotonlyledtotheafore-mentionedproblems,butalsotofundamentalproblemsthatpreventedimplementingsomeadditionalfeaturewaywhereitdidnotreallymatteriftheproblemexisted.Surelysomeofthesepeoplehadsleeplessnightstryingtotrackdownweirdbugsthattheycouldnotpinpoint.Theformergroupdealtwiththisproblembyalwayspassingandassigningobjectsbyreference.Thiswouldpreventtheenginefromcopyingtheirobjects,butitwouldbeaheadachebecausethecodeincludednumerous&signs.Theoldobjectmodelnotonlyledtotheafore-mentionedproblems,butalsotofundamentalproblemsthatpreventedimplementingsomeadditionalfeaturesontopoftheexistingobjectmodel.InPHP5,theinfrastructureoftheobjectmodelwasrewrittentoworkwithobjecthandles.Unlessyouexplicitlycloneanobjectbyusingtheclonekeyword,younevercreatebehind-the-scenesduplicatesofyourobjects.InPHP5,youdon'tneedaneedtopassobjectsbyreferenceorassignthembyreference.NotePassingbyreferenceandassigningbyreferencearestillsupported,incaseyouwanttoactuallychangeavariable'scontent(whetherobjectorothertype).
B.BuildDevelopmentEnvironment
AtpresenttherearemanydevelopmentplatformbasedonPHP.GenerallymostdeveloperslikethedevelopmentenvironmentLAMP.Thosewhohavecertaindevelopmentexperiencecansetuptheirdevelopmentplatformbychoosingtherelatedserver,DBMS,andoperatingsystem.TherearesomePHPIDE(integrateddevelopmentenvironment)suchasAMPSERV,WAMP,XMAPP,APPSERV,PHPSTUDYinthemarketforthedevelopersdevelopthewebsitebyusingPHP.AtpresentthemainPHPIDEisZendStudio,whichhasincludeddevelopingcomponentsforPHP.Itreducesthedevelopmenttimeandsimplifiesthecomplexapplicationplanduringedition,debugging,analysisandoptimization.TheZendStudionotonlyhascodeforhighmeasurement,grammarshrinkingautomaticallyandbookmark,butalsoitsembeddeddebuggerwhichfitsforlocalandremotedebuggingpatterns.Itismanyhighdebuggingfunctionssuchasvariabletracking,Single-stepoperation,breakpoint,functioncalling,andsoon.Moreover,itisalsoverystableinsupportingChineseforthelatestversion.
C.NotesinBuildingtheDevelopmentEnvironment
Thosewhoareunfamiliarwiththedevelopmentenvironmentdonotsetitupbyhimselfforitmaycauseaconflictbetweenvariousedition,moreoveritisverydifficulttosolvethecomplexconfigurationproblem.•PHPlanguageversion.Beforedevelopment,youmustensureconsistenceoftheeditionbetweenPHPlanguageandtheserver.NowPHPmainlyhastwoeditions(PHP4andPHP5).ThedifferentversionshavethedifferencewithSESSION,exceptionhandling,thevariablerange,thedatatypeandsoon.•Serverproblem.TheprogramwhichiseditedwithPHPinthewindowsplatformwillbearrangedontheapacheserver.IfitisarrangedonIISitleadstosomeincompatibleproblemsandsomeupdatebymanualsuchaswritablerightsissetupbeforeuploadingthearrangedontheapacheserverdocument.TherearenottheseproblemsifitisDatabaseproblem.DBMSusingwithPHPhasMYSQL,ORACLEandsoon.MYSQLiswelcomedbymostofthedevelopersforitisopensource,free,andefficient.MYSQLisperfectdatabaseserversoftwareformediumandsmallapplicationsystem.BesidesstandardANSISQL,italsosupportsmanyplatforms.OntheUnix/Linuxsystem,MYSQLalsosupportsthemulti-thread.MYSQLbecomesthefirstchoiceofmiddleandsmalllevelPHPwebsiteforitisopensourceanditprovidesaseriesofsupportssuchasread-writeaccess.
3.THEDEVELOPMENTMODELBASEDONPHP
PHPbecomesthemaindevelopmentlanguageinthesmallandmedium-sizedenterprisewebsiteforitisfree,opensource,etc.Thedevelopmentstepisasfollows:
A.Demandanalysis
Therearevariousdemandsforawebsiteproject.Thosedemandsoftenstemfromorcompanyoneselfneeds,mostofwhichistheactualneedsofcustomers.Whatextenttheprojectleadersunderstandtheuser'sneedshasdecidedwhetherissuccessorfailureindevelopingthewebsite.Thereforeuser'sneedsintheformofdocumentcanclearlybetransformedint