I-PHP: Ingabe i-SimpleXML ilayishiwe?

Ama-Depositphotos 11843590 s

Kunama-plugins ambalwa engiwakhile adinga i-PHP5 + ne- I-SimpleXML. I-SimpleXML iyindlela elula futhi esebenza kangcono yokuhlukanisa izimpendulo ze-XML kusuka APIs. Inkinga, nokho, ukuthi ngithola kuma-imeyili ambalwa ngosuku noma ngeviki ngibuze ukuthi kungani umsebenzisi engakwazanga ukulayisha uhlelo futhi kwaholela emaphutheni.

Ngokusobala, izaziso zami kuma-plugins nasemakhasini wephrojekthi bezinganele, ngakho-ke ngenze into efanelekile futhi ngengeza ukusebenza kuwo womabili ama-plugins ukuqinisekisa ukuthi isandiso se-SimpleXML silayishiwe.

Umsebenzi we-PHP wokubheka isandiso se-SimpleXML silayishiwe:

umsebenzi isSimpleXMLLoaded () {$ array = array (); $ array = get_loaded_extensions (); $ umphumela = amanga; i-foreach ($ array as $ i => $ value) {if (strtolower ($ value) == "simplexml") {$ result = true; }} buyisela imiphumela engu- $; }

Manje, ngaphakathi kwemisebenzi esebenzisa i-SimpleXML, ngingavele ngiqinisekise ukuthi ilayishiwe ngaphambi kokuthi ngizame ikholi ye-SimpleXML. Uma

uma (! isSimpleXMLLoaded ()) {echo "Bamba isiza sakho kwenye indawo!"; buyela; }

Ngiyazi ukuthi ngine-PHP gurus ebheka ibhulogi yami, ungazise ukuthi ngenze kanjani! Ngikhiphe izibuyekezo ezincane kuwo womabili ama-plugins ukusebenzisa le ndlela.

6 Amazwana

  1. 1

    Sawubona Doug,

    Ngibonile isiphazamisi esisodwa okungenzeka ukuthi asivezi iphutha.

    uma ($ value = “SimpleXML”) {$ result = true; }

    kufanele

    uma ($ value == “SimpleXML”) {$ result = true; }

    Yize kungenxa yokuphepha. Ngincamela.

    uma (strtolower ($ value) == “simplexml”) {$ result = true; }

    Ungasebenzisa futhi i-'extension_loaded 'ethatha igama lesandiso ukulihlola (libucayi).

    $ loaded = extension_loaded (“SimpleXML”);

    Ibuyisa IQINISO noma AMANGA.

    I-PS Ungaziphuzeli ikhofi kepha ngingafaka inkinobho ethi 'ngithengele ibhokisi lamadonathi'

    • 2

      Thola leyo nkinobho yedonathi phezulu, Nick! Ungumsindisi! Okuhlekisayo ukuthi (kukhishwe i-strtolower), empeleni benginekhodi yami eyisampula esebenza futhi ngisebenzisa ukuhlolwa okulungile. Kufanele ukuthi bese kuhlwile ngoba ngesikhathi ngiyifaka, ngiyihlanze!

      Ngiguqule ikhodi nokuthunyelwe kwebhulogi. Umbuzo: Noma yikuphi ukuthuthuka komunye ngaphezu komunye? Ngicabanga ukuthi i-extension_loaded iyindlela ehlanzekile futhi esheshayo yokubhekana nalokhu!

      Ngiyabonga Nick!

  2. 4

    yum ukufaka php55-xml.x86_64 ukufaka i-XML elula ye-php 5.5.11

    Ukugijima kokuThutha
    Ukufaka: php55-xml-5.5.11-1.el6.x86_64 1/1
    Iyaqinisekisa: php55-xml-5.5.11-1.el6.x86_64 1/1

    bese ifakwa
    /usr/lib64/php/modules/simplexml.so

  3. 5

UCABANGANI?

Le sayithi isebenzisa i-Akismet ukunciphisa ugaxekile. Funda ukuthi idatha yakho yokuphawula isetshenziswa kanjani.