I-PHP: Ngaba ilula i-XML?

Iidipozithi iifoto 11843590 s

Kukho iiplagi ezimbalwa endizenzileyo ezifuna i-PHP5 + kunye ElulaXML. I-SimpleXML yeyona ndlela ilula kwaye isebenzayo yokwenza iindlela zeempendulo zeXML ukusuka APIs. Ingxaki, nangona kunjalo, kukuba ndiza kufumana ii-imeyile ezimbalwa ngosuku okanye ngeveki zindibuze ukuba kutheni umsebenzisi engakwazi ukulayisha inkqubo kwaye ikhokelele kwiimpazamo.

Kuyabonakala ukuba, izaziso zam kwiiplagi kunye nakwiphepha leprojekthi bezingonelanga, ndiye ndenza into elungileyo ndongeza ukusebenza kuzo zombini iiplagi ukuqinisekisa ukongezwa kwe-SimpleXML kulayishiwe.

Umsebenzi we-PHP ukukhangela ulwandiso lwe-SimpleXML lulayishiwe:

Umsebenzi nguSimpleXMLLoaded () {$ array = uluhlu (); $ array = fumana_izilayishi_zolwandiso (); $ isiphumo = bubuxoki; i-foreach ($ array njenge $ i => $ value) {if (strtolower ($ value) == "simplexml") {$ result = true; }} buyisela isiphumo seedola; }

Ngoku, ngaphakathi kwemisebenzi esebenzisa i-SimpleXML, ndinokuqinisekisa ukuba iyalayishwa ngaphambi kokuba ndizame umnxeba we-SimpleXML. Ukuba

ukuba (! isSimpleXMLLoaded ()) {echo "Bamba indawo yakho kwenye indawo!"; buyela; }

Ndiyazi ukuba ndinayo i-PHP gurus egcina ibhlog yam, ndazise indlela endenze ngayo! Ndikhuphe uhlaziyo oluncinci kuzo zombini iiPlagi ukusebenzisa le ndlela.

6 Comments

  1. 1

    Molo Doug,

    Ndiqaphele ibug enye mhlawumbi ayiphakamisi mpazamo.

    ukuba (ixabiso le-$ = "SimpleXML") {$ isiphumo = yinyaniso; }

    kufuneke ku

    ukuba (ixabiso le-$ == “SimpleXML”) {$isiphumo = yinyaniso; }

    Nangona ngenxa yokhuseleko. Ndikhetha.

    ukuba (strtolower(ixabiso le-$) == “simplexml”) {$isiphumo = yinyani; }

    Ungasebenzisa kwakhona 'i-extension_loaded' ethatha igama lolwandiso ukujonga (ubuthathaka bemeko).

    $ ilayishiwe = extension_loaded (“SimpleXML”);

    Ibuyisela TRUE okanye FALSE.

    PS Musa ukusela ikofu ngokwam kodwa ndingabeka iqhosha elithi 'ndithengele ibhokisi yeedonathi' 🙂

    • 2

      Nyusa iqhosha le-donut, Nick! Ungumsindisi! Yintoni ehlekisayo kukuba (thabatha i-strtolower), eneneni bendinayo ikhowudi yam yesampulu esebenzayo kwaye ndisebenzisa uvavanyo oluchanekileyo. Inoba besele kuhlwile ngoba ngelaxesha ndiyfaka ndamosha!

      Ndiyilungisile ikhowudi kunye neposti yebhlog. Umbuzo: Ngaba ikhona inzuzo enye ngaphezu kwenye? Ndicinga ukuba i-extension_loaded yindlela ecocekileyo nekhawulezayo yokujongana nale nto!

      Enkosi Nick!

  2. 4

    yum faka php55-xml.x86_64 ukufaka i-simpleXML yephp 5.5.11

    Ukuqhuba iNtengiselwano
    Ukufakela : php55-xml-5.5.11-1.el6.x86_64 1/1
    Ukuqinisekisa : php55-xml-5.5.11-1.el6.x86_64 1/1

    kwaye emva koko yafaka
    /usr/lib64/php/modules/simplexml.so

  3. 5

Ingaba ucinga ntoni?

Le sayithi isebenzisa i-Akismet ukunciphisa ugaxekile. Funda indlela idatha yakho yokubhaliweyo isetyenziswe ngayo.