PHP: Shin ana ɗora Kwatancen SimpleXML?

Sanya hotuna 11843590 s

Akwai wasu plugins guda biyu waɗanda na gina waɗanda ke buƙatar PHP5 + kuma MATAMakiya. SimpleXML shine mafi sauƙin kuma mafi kyawun hanyar aiwatar da martani na XML daga APIs Matsalar, kodayake, zan iya samun 'yan imel sau ɗaya ko mako suna tambayata me yasa mai amfani bai iya ɗaukar shirin ba kuma hakan ya haifar da kurakurai.

A bayyane, sanarwa na akan abubuwan da aka saka a shafin kuma basu isa ba, don haka nayi abin da ya dace kuma na kara aiki a bangarorin biyu don tabbatar da cewa anyi lodi na SimpleXML.

Ayyukan PHP don bincika thearin SimpleXML an ɗora:

aiki isSimpleXMLLoaded () {$ array = array (); $ tsararru = get_loaded_extensions (); sakamakon $ = karya; foreach ($ tsararru kamar $ i => $ darajar) {idan (strtolower ($ darajar) == "simplexml") {$ sakamakon = gaskiya ne; }} dawo da sakamako; }

Yanzu, a cikin ayyukan da suke amfani da SimpleXML, zan iya tabbatar da cewa an ɗora shi kafin na gwada kiran SimpleXML. Idan

idan (! isSimpleXMLLoaded ()) {echo "Ku dauki bakuncin rukunin yanar gizonku a wani wuri!"; dawowa; }

Na san Ina da wasu gurus na PHP da ke sa ido a kan shafin yanar gizon, bari in san yadda na yi! Na saki ƙananan updatesaukakawa ga duka Plugins don amfani da wannan hanyar.

6 Comments

  1. 1

    Sannu Doug,

    Na lura da kwaro daya wanda watakila baya tayar da kuskure.

    idan ($ darajar = "SimpleXML") {$ sakamakon = gaskiya ne; }

    ya kamata

    idan ($ darajar == “SimpleXML”) {$ sakamakon = gaskiya ne; }

    Kodayake don kare lafiya. Na fi so

    idan (strtolower ($ darajar) == “simplexml”) {$ sakamakon = gaskiya ne; }

    Hakanan zaka iya amfani da 'extension_loaded' wanda ke ɗaukar sunan tsawo don bincika (mahimmin harka).

    $ load = extension_loaded ("SimpleXML");

    Dawowa GASKIYA ko KARYA.

    PS Kada ku sha kofi da kaina amma zan iya sanya 'siya min kwalin donuts' button 🙂

    • 2

      Samu wannan maɓallin donut ɗin, Nick! Kai mai ceton rai! Abin ban dariya shine (a cire mai strtolower), a zahiri na sami lambar samfurin nawa da ke gudana da kuma amfani da kimantawa daidai. Lallai yayi latti domin lokacin dana sanya shi, na dagula shi!

      Na gyara lambar da rubutun gidan yanar gizo. Tambaya: Shin wani fa'idar ɗayan yake da ɗayan? Ina tsammani tsawo_da aka loda shine mafi tsabta da sauri hanyar ma'amala da wannan!

      Na gode Nick!

  2. 4

    yum shigar php55-xml.x86_64 don shigar da saukiXML don php 5.5.11

    Gudun Ma'amala
    Girkawa: php55-xml-5.5.11-1.el6.x86_64 1/1
    Tabbatar: php55-xml-5.5.11-1.el6.x86_64 1/1

    sannan kuma ya girka
    /usr/lib64/php/modules/simplexml.so

  3. 5

Me kuke tunani?

Wannan shafin yana amfani da Akismet don rage spam. Koyi yadda aka sarrafa bayanan bayaninka.