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; }

Ama m na enwetala ụfọdụ ederede nke PHP nke na - elekwasị anya na blọọgụ m, ka m mara etu m siri mee! Emeputala m obere mmelite na Plugins iji usoro a.

6 Comments

  1. 1

    Ndewo Doug,

    Achọpụtara m otu ahụhụ nke nwere ike iwepụtaghị njehie.

    ọ bụrụ na ($ uru = “SimpleXML”) {$ utịp = eziokwu; }

    kwesịrị ịbụ

    ọ bụrụ na ($ uru == “SimpleXML”) {$ utịp = eziokwu; }

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

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

    I nwekwara ike iji 'extension_loaded' nke na - ewe aha ndọtị iji lelee (okwu gbasara ya).

    $ loaded = extension_loaded ("SimpleXML");

    Lọghachi EZIOKWU ma ọ bụ ALgha.

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

    • 2

      Nweta bọtịnụ donut ahụ, Nick! You're bụ onye na-azọpụta ndụ! Ihe na-atọ ọchị bụ na (mwepu nke strtolower), enwere m koodu m na-agba ma na-eji nyocha ziri ezi. Ọ ga-abụrịrị na oge abịala n'ihi na site na mgbe m tinyere ya, agbaturu m ya!

      Emechara m gbanwee koodu na post blọgụ. Ajụjụ: Uru ọ bụla bara n’etiti ndị ọzọ? Echere m na ndọtị_igbe ahụ bụ ụzọ dị ọcha karị na ngwa ngwa iji mesoo nke a!

      Daalụ Nick!

  2. 4

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

    Azụmahịa Na-agba ọsọ
    Ingwụnye: php55-xml-5.5.11-1.el6.x86_64 1/1
    Nyochaa: php55-xml-5.5.11-1.el6.x86_64 1/1

    wee wụnye 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ị.