PHP: ZvakarerukaXML Yakatakurwa?

Depositphotos 11843590 s

Pane mapulagini mashoma andakavaka ayo anoda PHP5 + uye NyoreXML. SimpleXML inzira iri nyore uye iri nani yekugadzirisa mhinduro dzeXML kubva APIs. Dambudziko, zvakadaro, nderekuti ini ndaizowana pane mashoma maemail pazuva kana pavhiki kundibvunza kuti sei mushandisi asingakwanise kurodha chirongwa uye zvakakonzera zvikanganiso.

Sezviri pachena, zviziviso zvangu pamapulagi uye pamapeji eprojekiti zvaive zvisina kukwana, saka ndakaita chinhu chakakodzera uye ndikawedzera mashandiro kumapulagi ese maviri kuti ndione kuwedzera kweXXXLL kwakatakurwa.

PHP Basa rekutarisa iyo SimpleXML yekuwedzera yakatakurwa:

basa isSimpleXMLLoaded () {$ array = array (); $ rondedzero = tora_kuregedza_zvinyorwa (); $ mhedzisiro = manyepo; foreach ($ array as $ i => $ value) {if (strtolower ($ value) == "simplexml") {$ result = true; }} dzosera mhedzisiro; }

Zvino, mukati memabasa anoshandisa SimpleXML, ini ndinogona kungoona kuti yakatakurwa ndisati ndamboedza iyo SimpleXML kufona. Kana

kana (! isSimpleXMLLoaded ()) {echo "Gamuchira saiti yako kumwe kunhu!"; dzoka; }

Ndoziva ini ndine PHP gurus iyo inocherekedza bhurogu yangu, ndiudzeiwo maitiro andakaita! Ndaburitsa zvidiki zvidiki kune ese maPulagi kuti ushandise iyi nzira.

6 Comments

  1. 1

    Mhoro Doug,

    Ndakaona imwe bhagi iyo ingangodaro isingasimudze chikanganiso.

    kana ($ value = "SimpleXML") {$ result = ichokwadi; }

    kunge

    kana ($ value == "SimpleXML") {$ result = ichokwadi; }

    Kunyangwe nekuda kwekuchengetedza. Ndinosarudza.

    kana (strtolower ($ value) == "simplexml") {$ result = ichokwadi; }

    Iwe unogona zvakare kushandisa 'extension_loaded' iyo inotora iyo yekuwedzera zita kutarisa (kesi inonzwisisika).

    $ yakatakura = kuwedzerwa_kuregedzwa ("SimpleXML");

    Inodzosera CHOKWADI kana KUNYEPA.

    PS Usanwa kofi pachangu asi ini ndinogona kuisa 'nditengere bhokisi remadhoni' bhatani 🙂

    • 2

      Tora iro bhatani dhoni kumusoro, Nick! Iwe uri livesaver! Zvinosetsa ndezvekuti (kubvisa strolower), ini ndaitove neyangu yekuenzanisira kodhi ichimhanya uye kushandisa chaiyo kuongorora. Inofanira kunge yakanonoka nekuti panguva yandakayiisa mukati, ndakaikanganisa!

      Ini ndashandura kodhi uye iyo blog post. Mubvunzo: Chero mukana weumwe pamusoro peumwe? Ini ndinofungidzira iyo yekuwedzera_kuregedzesa iri yakachena zvakanyanya uye inokurumidza nzira yekubata neizvi!

      Ndatenda Nick!

  2. 4

    yum kuisa php55-xml.x86_64 kuisa yakapusaXML ye php 5.5.11

    Kumhanya Transaction
    Kuisa: php55-xml-5.5.11-1.el6.x86_64 1/1
    Kuongorora: php55-xml-5.5.11-1.el6.x86_64 1/1

    uye yakabva yaiswa
    /usr/lib64/php/modules/simplexml.so

  3. 5

Unofungei?

Nzvimbo iyi inoshandisa Akismet kuderedza spam. Dzidza kuti sei deta yako inoshandiswa.