PHP: SimpleXML Miyuu Shuban Yahay?

Kaydinta sawirrada 11843590 s

Waxaa jira dhowr lammaane oo aan dhisay oo u baahan PHP5 + iyo SimpleXML. SimpleXML waa qaab aad u fudud uguna wanaagsan oo lagu falanqeeyo jawaabaha XML APIs. Dhibaatadu, si kastaba ha noqotee, waa in aan ka heli lahaa emayl yar maalin ama usbuuc aniga oo i weydiiya sababta uu isticmaalehu u rari kari waayey barnaamijka oo ay khaladaad ka dhasheen.

Sida muuqata, ogeysiisyadeyda kujira sheyga iyo boggaga mashruuca kuma filneyn, marka waxaan sameeyay wax sax ah oo waxaan kudarey wax qabad labadaba si aan uxaqiijiyo kordhinta SimpleXML.

Waxqabadka PHP si loo hubiyo kordhinta SimpleXML waa la raray:

shaqadu waaSimpleXMLLoaded () {$ array = array (); $ array = get_loaded_extensions (); $ natiijo = been ah; foreach ($ array sida $ i => $ qiimaha) {haddii (strtolower ($ qiimaha) == "simplexml") {$ natiijo = run; }} soo celi $ natiijo; }

Hadda, gudahood howlaha adeegsanaya SimpleXML, waxaan si fudud u xaqiijin karaa inay rar tahay ka hor intaanan runti isku deyin wicitaanka SimpleXML. Haddii

haddii (! isSimpleXMLLoaded ()) {echo "Ku marti geli bartaada meel kale!"; soo noqosho; }

Waan ogahay inaan haysto xoogaa PHP ah oo isha ku haya boggeyga, ii sheeg sidaan sameeyay! Waxaan u sii daayay cusbooneysiin yar-yar labada Plugins si aan uga faa'ideysto habkan.

6 Comments

  1. 1

    Nabad Doug,

    Waxaan ogaaday hal bug oo laga yaabo inuusan qalad kicin.

    haddii ($ qiimaha = "SimpleXML") {$ natiijo = run; }

    waa in

    haddii ($ qiimaha == “SimpleXML”) {$ natiijada = run; }

    In kastoo nabadgelyo dartiis. Waan ka door biday

    haddii (strtolower ($ qiimaha) == “simplexml”) {$ natiijada = run; }

    Waxa kale oo aad isticmaali kartaa 'extension_loaded' oo qaadata magaca kordhinta si loo hubiyo (kiis xasaasi ah).

    $ xamuul = extension_loaded ("SimpleXML");

    Sooceliyaa RUN ama been.

    PS Ha cabin kafeega naftayda laakiin waxaa laga yaabaa inaan dhigo batoonka 'ii soo iibso sanduuq sanduuq ah' 🙂

    • 2

      Qaado badhanka dusha sare, Nick! Waxaad tahay badbaadiye! Waa maxay qosolka ayaa ah in (laga jaray strtolower), dhab ahaantii waxaan haystay nambarkayga muunad shaqeynaya iyo ka faa'iideysiga qiimeynta saxda ah. Waa inay soo daahday maxaa yeelay markii aan galiyay, waan qasanaa!

      Waxaan wax ka beddelay koodhka iyo boostada. Su'aal: Faa'iidooyin kasta oo midkood kan kale leeyahay? Waxaan u maleynayaa in kordhinta-la soo rogay ay tahay mid ka nadiifsan oo dhaqso badan wax ka qabashada tan!

      Mahadsanid Nick!

  2. 4

    yum rakib php55-xml.x86_64 si loo rakibo fududXML ee php 5.5.11

    Macaamil Ganacsi
    Rakibidda: php55-xml-5.5.11-1.el6.x86_64 1/1
    Hubinta: php55-xml-5.5.11-1.el6.x86_64 1/1

    ka dibna waa la rakibay
    /usr/lib64/php/modules/simplexml.so

  3. 5

Maxay idinla tahay?

Boggani wuxuu isticmaalaa Akismet si loo yareeyo spam. Baro sida xogtaada faallooyinkaaga looga shaqeeyo.