PHP: Ndi SimpleXML Akwadoro?

Depositphotos 11843590 nwere

Enwere plugins di na nwunye m wuru nke chọrọ PHP5 + na MfeXML. SimpleXML bụ usoro dị mfe karị ma dị mma nke na-enyocha nzaghachi XML APIs Otú ọ dị, nsogbu bụ na m ga-enweta ozi ịntanetị ole na ole kwa ụbọchị ma ọ bụ izu na-ajụ m ihe kpatara na onye ọrụ enweghị ike ibudata mmemme ahụ ma ọ kpatara njehie.

O doro anya na ọkwa m na plugins na peeji nke ọrụ ahụ ezughị, n'ihi ya, m mere ihe ziri ezi ma gbakwunye ọrụ na plugins abụọ iji nyochaa ndọtị nke SimpleXML.

Ọrụ PHP iji lelee ndọtị SimpleXML ka ebu:

ọrụ isSimpleXMLLoaded () {$ array = array (); $ array = nweta_loaded_extensions (); $ result = ugha; foreach ($ array dị ka $ i => $ uru) {ọ bụrụ (strtolower ($ uru) == "simplexml") {$ result = true; }} laghachi $ nsonaazụ; }

Ugbu a, n'ime ọrụ ndị na-eji SimpleXML, enwere m ike ị hụ na ebubatala ya tupu m gbalịa oku SimpleXML. Ọ bụrụ

ọ bụrụ na (! isSimpleXMLLoaded ()) {ikwughachi "Gaa na saịtị gị ebe ọzọ!"; laghachi; }

Amaara m na enwetara ụfọdụ ederede PHP nke na-elekwasị anya na blọọgụ m, mee ka m mara ka m siri mee! M tọhapụrụ obere mmelite abụọ Plugins iji usoro a.

6 Comments

  1. 1

    Hi Doug,

    Achọpụtara m otu ahụhụ nke nwere ike ọ naghị ebulite mperi.

    ọ bụrụ ($ uru = "SimpleXML") {$ nsonaazụ = eziokwu; }

    kwesịrị ịbụ

    ọ bụrụ ($ uru == "SimpleXML") {$ nsonaazụ = eziokwu; }

    Ọ bụ ezie na maka nchekwa. Ọ masịrị m.

    ọ bụrụ na (strtolower ($ uru) == “simplexml”) {$ nsonaazụ = eziokwu; }

    Ịnwekwara ike iji 'extension_loaded' nke na-ewe aha ndọtị ka ịlele (ihe dị mkpa).

    $loaded = extension_loaded ("SimpleXML");

    Na-eweghachi EZIOKWU ma ọ bụ Ụgha.

    PS Aṅụla kọfị n'onwe m mana enwere m ike itinye bọtịnụ 'zụtara m igbe donuts' 🙂

    • 2

      Nweta bọtịnụ donut ahụ, Nick! Ị bụ onye ndu! Ihe na-atọ ọchị bụ na (mwepu strtolower), M n'ezie nwere m sample koodu na-agba ọsọ na tinye n'ọrụ ziri ezi nwale. Ọ ga-abụrịrị na ọ gafeela n'ihi na mgbe m tinyechara ya, agbaghara m ya!

      Agbanwela m koodu na blọgụ post. Ajụjụ: Enwere uru otu karịa ibe ya? Echere m na extension_loaded bụ ụzọ dị ọcha ma dịkwa ngwa ngwa maka nke a!

      Daalụ Nick!

  2. 4

    yum tinye php55-xml.x86_64 iji wụnye simpleXML maka php 5.5.11

    Azụmahịa na-agba ọsọ
    Ịwụnye: php55-xml-5.5.11-1.el6.x86_64 1/1
    Na-enyocha: php55-xml-5.5.11-1.el6.x86_64 1/1

    wee tinye ya
    /usr/lib64/php/modules/simplexml.so

  3. 5

Kedu ihe ị chere?

Ebe a na-eji Akismet iji belata spam. Mụta otu esi etinye usoro data gị.