Iplagi ye-AMP ye-PHP-Khuphela kunye nemiyalelo

Nge- AMP ye-plugin ye-PHP unokwenza ngokulula, ngokuzenzekelayo, wenze amaphepha e-Google AMP kwiiwebhusayithi zakho.

Lungiselela iwebhusayithi yakho ye-PHP yezixhobo eziphathwayo kunye neGoogle Isalathiso sokuqala seFowuni ngaphandle kokudwelisa eyakho inguqulelo yeAMPHTML kwiphepha ngalinye lakho!

Vavanya ngaphandle: Faka. Yenza kusebenze. Igqitywe tu!


Isibhengezo

Faka iplagi ye-AMP PHP


description

Ingcebiso ngaphambi kokuba uqale ukufaka i-plug-in ye-PHP-AMP: Kwezinye izisombululo ze-CMS, amp-cloud.de ibonelela nge-plug-ins ezikhethekileyo zeGoogle AMP ekulula nokufaka kunye nokulawula! Njengenye indlela eya kwi "AMP ye-plug-in ye-PHP" , enye yezi zilandelayo plug-ins zikaGoogle AMP inokuba ngumdla kuwe:


Inyathelo-1: Khuphela "i-AMP ye-plugin ye-PHP"

Khuphela uguqulelo lwangoku lwe "AMP ye-PHP Plugin" njengefayile ye-ZIP kule khonkco ilandelayo yokukhuphela. -Ifayile ye-ZIP inefowulda ebizwa ngokuba yi "amp" equle zonke iifayile ezifunekayo ukufaka kunye nokusebenzisa i-plug-in ye-AMP


Inyathelo-2: Ukukhupha i- "AMP ye-PHP Plugin" -ZIP-file

Unzip / khupha ifayile ye-ZIP ekhutshelweyo.

  • Emva kokukhupha / ukukhupha kufuneka ube ne "ifolda" enegama "/ amp /" apho iifayile zeplagi ze-PHP-AMP zikhona.

Inyathelo-3: Gcina iifayile ze-plugin ze-PHP kwiserver yewebhu

Faka ifolda engavulelwanga enegama "/ amp /" kulawulo lweengcambu lwewebhu yakho ukuze ifolda ifikelele kwiwebhusayithi yakho phantsi kwale URL ilandelayo:

  • www.DeineDomain.de/amp/

Ukuvavanya ukuba ifolda igcinwe ngokuchanekileyo na kwiseva yakho yewebhu, biza nje i-URL elandelayo- Ukuba ufakelo luchanekile, kuya kufuneka ubone umyalezo okuxelela ukuba iwebhusayithi yakho isebenzisa i-plug-in ye-AMP ukusuka amp-cloud.de, Ngaphandle koko iplagi ayifakwanga ngokuchanekileyo kwaye kuya kufuneka uphinde ulandele la manyathelo angentla:

  • www.DeineDomain.de/amp/amp.php
    (Ewe kuya kufuneka ubeke endaweni yakho kwi-www.yourdomain.de nedilesi yewebhusayithi yakho)

Inyathelo-4: faka i-AMPHTML tag!

Okokugqibela, kubandakanya ukutyhala isiseko ngasinye , ofuna ukusinika uguqulelo lwe-AMP, usebenzisa enye yezi zinto zilandelayo <link rel = "amphtml"> - usuku kwi <head> icandelo lesiseko esihambelanayo.

  • Inguqulelo 1:

    <link rel = "amphtml" href = "http: // www.DeineDomain.de /amp/amp.php?url= inqaku lakho URL" />
    • Faka endaweni ye "http: //" indawo nge "https: //" ukuba usebenzisa i-HTTPS kwiwebhusayithi yakho
    • Guqula indawo ethi "www.yourdomain.de" kunye nethambeka lewebhusayithi yakho
    • Guqula indawo "ye-URL yakho yeNqaku" nge- UTF8 encod URL ye -subpage efanelekileyo apho ubandakanya khona ithegi ye-AMPHTML (incl. "Http: //" okanye "https: //")

      Ukwenza ikhowudi ye-URL ngokufanelekileyo, ungasebenzisa oku kulandelayo nge-URL yasimahla kwi-Intanethi, umzekelo: https://www.url-encode-online.rocks/

      Umzekelo we-URL efakwe kwi-UTF-8:
      Ingcaciso:

      Umzekelo we-UTF-8 ye-URL emiselweyo:
      https://www.DeineDomain.de/DeinPfad/DeineDatei.php?parameter=Süß&sprache=DE

  • Umahluko 2:

    <link rel="amphtml" href=" http:// ".$_SERVER['HTTP_HOST']."/amp/amp.php?url=".urlencode(" http:// ".$_SERVER['HTTP_HOST '].$_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING']."")."" />
    • Ukuba usebenzisa i-HTTPS kwiwebhusayithi yakho, buyisela la malungu mabini "http: //" ngo "https: //"

Umzekelo wekhowudi ye-AMP PHP


code
<?php echo " <!DOCTYPE html> <html> <head> <title> Isihloko sakho se meta ... </title> <link rel="amphtml" href="https://".$_SERVER['HTTP_HOST']."/amp/amp.php?url=".urlencode("https://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING']."")."" /> </head> <body> Ikhowudi yakho yomthombo womzimba ... </body> </html> ;" ?>

Kutheni usebenzisa iplagi ye-AMP PHP?


power

I-AMP esemthethweni ye-plugin ye-PHP evela ku-amp-cloud.de isebenze amaPhepha eeMfono eziKhawulezileyo (i-AMP) kwiiwebhusayithi zakho ze-PHP, ngokuthe ngqo phantsi komgcini wakho, njengoko kucetyiswa sisikhokelo se-AMP sikaGoogle!


Isibhengezo