PHP AMP Gucomeka - Gukuramo & Amabwiriza

Hamwe na AMP ya plugin ya PHP urashobora byoroshye, byimazeyo, gukora page ya Google AMP kurubuga rwawe.

Hindura urubuga rwa PHP kubikoresho bigendanwa hamwe na Google Yambere Yambere ya Google utiriwe ukora progaramu yawe ya AMPHTML kuri buri paji yawe!

Gerageza: Shyira. Kora. Byarangiye!


Kwamamaza

Shyiramo plugin ya AMP PHP


description

Inama mbere yuko utangira kwinjizamo plug-in ya PHP-AMP: Kubisubizo bimwe na bimwe bya CMS, amp-cloud.de itanga amacomeka yihariye ya Google AMP ndetse byoroshye kuyashiraho no kuyacunga! - Nkubundi buryo bwa "AMP kuri plug-in ya PHP" , imwe muma plug-ins ya Google AMP ikurikira irashobora kugushimisha:


Intambwe-1: Kuramo "AMP kuri plugin ya PHP"

Kuramo verisiyo ya "AMP ya PHP Plugin" nka dosiye ya ZIP uhereye kumurongo ukurikira. - Idosiye ya ZIP irimo ububiko bwitwa "amp" bukubiyemo dosiye zose zisabwa kugirango ushyire kandi ukoreshe AMP plug-in.


Intambwe-2: Kuramo "AMP ya plugin ya PHP" -ZIP-dosiye

Kuramo / gukuramo dosiye ZIP yakuweho.

  • Nyuma yo gupakurura / gukuramo ugomba kuba ufite "ububiko" hamwe nizina "/ amp /" aho dosiye ya plugin ya PHP-AMP iherereye.

Intambwe-3: Bika dosiye ya plugin ya PHP kurubuga rwurubuga

Kuramo ububiko butabitswe hamwe nizina "/ amp /" mububiko bwumuzi wa seriveri yawe kugirango ububiko bugere kurubuga rwawe munsi ya URL ikurikira:

  • www.DeineDomain.de/amp/

Kugirango umenye niba ububiko bwabitswe neza kurubuga rwawe, hamagara gusa URL ikurikira - Niba iyinjizamo ari ryiza, ugomba kubona ubutumwa bukubwira ko urubuga rwawe rukoresha AMP icomeka kuri amp-cloud.de, bitabaye ibyo plugin ntabwo yashyizweho neza kandi ugomba kongera kunyura murwego rwo hejuru:

  • www.DeineDomain.de/amp/amp.php
    (Birumvikana ko ugomba gusimbuza www.yourdomain.de hamwe na aderesi y'urubuga rwawe)

Intambwe-4: shyiramo tagi ya AMPHTML!

Ubwanyuma, shyiramo gusunika buri shingiro, kubyo ushaka gutanga verisiyo ya AMP, ukoresheje imwe muburyo bukurikira a <link rel = "amphtml"> - umunsi mugice cya <head> igice cyibanze .

  • Inyandiko ya 1:

    <ihuza rel = "amphtml" href = "http: // www.DeineDomain.de /amp/amp.php?url= IhrArtikelURL " />
    • Simbuza igice "http: //" na "https: //" niba ukoresha HTTPS kurubuga rwawe
    • Simbuza igice "www.yourdomain.de" hamwe nurubuga rwurubuga rwawe
    • Simbuza igice cya "YourAr ArticleURL" hamwe na UTF8 ifite kodegisi ya URL ya subpage ushyiraho tagi ya AMPHTML (incl. "Http: //" cyangwa "https: //")

      Kugirango ushireho URL uko bikwiye, urashobora gukoresha kodegisi ya URL yubuntu ikurikira, kurugero: https://www.url-encode-online.rocks/

      Urugero kuri UTF-8 yashizwemo URL:
      https% 3A% 2F% 2Fwww.

      Urugero rwa URL ya UTF-8:
      https://www.DeineDomain.de/DeinPfad/DeineDatei.php?parameter=Süß&sprache=DE

  • Ibitandukanye 2:

    <ihuza rel = "amphtml" href = " http: // ". $ _ UMUKOZI ['HTTP_HOST']. "/ amp / amp.php? url =". urlencode (" http: // ". ']. $ _ UMUKORESHE [' PHP_SELF ']. "?". $ _ UMUKOROZI
    • Niba ukoresha HTTPS kurubuga rwawe, simbuza ibice bibiri "http: //" na "https: //"

Urugero rwa AMP PHP urugero


code
<?php echo " <!DOCTYPE html> <html> <head> <title> Umutwe wawe wa 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> Kode yumubiri wawe ... </body> </html> ;" ?>

Kuki ukoresha plugin ya AMP PHP?


power

AMP yemewe ya plugin ya PHP kuva amp-cloud.de ikora page yihuta ya paji igendanwa (AMP) kurubuga rwawe bwite rwa PHP, munsi yuwakiriye, nkuko byasabwe nubuyobozi bwa Google AMP!


Kwamamaza