PHP: Na SimpleXML e Laetsoe?

Litšoantšo tsa Depositph 11843590 s

Ho na le li-plugins tse 'maloa tseo ke li hahileng tse hlokang PHP5 + le BonoloXML. SimpleXML ke mokhoa o bonolo haholoanyane oa ho etsa likarabo tsa XML ho tsoa ho APIs. Bothata, leha ho le joalo, ke hore ke ne ke fumana li-imeile tse 'maloa ka letsatsi kapa ka beke ho mpotsa hore na hobaneng mosebelisi a sa khone ho kenya lenaneo mme e felle ka liphoso.

Kamoo ho bonahalang kateng, litsebiso tsa ka ho li-plugins le maqepheng a projeke li ne li sa lekana, ka hona ke entse ntho e nepahetseng mme ka eketsa ts'ebetso ho li-plugins ka bobeli ho netefatsa hore katoloso ea SimpleXML e laetsoe.

Mosebetsi oa PHP ho lekola katoloso ea SimpleXML e laetsoe:

mosebetsi isSimpleXMLLoaded () {$ array = array (); $ array = fumana_loaded_extensions (); $ sephetho = bohata; foreach ($ array as $ i => $ value) {if (strtolower ($ value) == "simplexml") {$ result = nete; }} khutlisetsa sephetho sa $; }

Hona joale, ka har'a mesebetsi e sebelisang SimpleXML, nka tiisa feela hore e laetsoe pele ke leka mohala oa SimpleXML. Haeba

haeba (! isSimpleXMLLoaded ()) {echo "Tšoara sebaka sa hau sa marang-rang kae kae!"; khutla; }

Kea tseba hore ke na le li-gurus tsa PHP tse shebileng blog ea ka, ntumelle hore na ke entse joang! Ke lokolotse lintlafatso tse nyane ho li-plugins ka bobeli ho sebelisa mokhoa ona.

6 Comments

  1. 1

    Hi Doug,

    Ke hlokometse phoso e le 'ngoe eo mohlomong e sa hlahiseng phoso.

    haeba ($ value = “SimpleXML”) {$sephetho = nnete; }

    e lokela ho ba

    haeba ($ value == “SimpleXML”) {$sephetho = nnete; }

    Leha e le molemong oa polokeho. Ke khetha.

    haeba (strtolower($ value) == “simplexml”) {$sephetho = nnete; }

    U ka boela ua sebelisa 'extension_loaded' e nkang lebitso la katoloso ho le hlahloba (bothata ba linyeoe).

    $e laetsoe = extension_loaded(“SimpleXML”);

    E khutlisa NNETE kapa LESHANO.

    PS Ha ke noe kofi ka bonna empa nka beha konopo ea 'nthekele lebokose la li-donuts' 🙂

    • 2

      Fumana konopo ea donut holimo, Nick! U mopholosi! Se qabolang ke hore (ho tlosa strtolower), ke ne ke e-na le khoutu ea ka ea mohlala e sebetsang le ho sebelisa tlhahlobo e nepahetseng. E tlameha ebe e ne e se e le morao haholo hobane ha ke e kenya, ke ne ke e senyehile!

      Ke fetotse khoutu le poso ea blog. Potso: Na ho na le molemo o mong ho feta o mong? Ke nahana hore extension_loaded ke mokhoa o hloekileng le o potlakileng oa ho sebetsana le sena!

      Kea leboha Nick!

  2. 4

    yum kenya php55-xml.x86_64 ho kenya simpleXML bakeng sa php 5.5.11

    Ho tsamaisa Transaction
    Ho kenya: php55-xml-5.5.11-1.el6.x86_64 1/1
    Netefatsa : php55-xml-5.5.11-1.el6.x86_64 1/1

    eaba e hlomamisa
    /usr/lib64/php/modules/simplexml.so

  3. 5

U nahana eng?

Sebaka sena se sebelisa Akismet ho fokotsa spam. Ithute kamoo litlhaloso tsa hau li hlahang kateng.