Ohun itanna AMP PHP - Ṣe igbasilẹ & Awọn ilana

Pẹlu AMP fun ohun itanna PHP o le ni irọrun, ni adaṣe laifọwọyi, ṣẹda awọn oju-iwe AMP Google fun awọn oju opo wẹẹbu rẹ.

Je ki oju opo wẹẹbu PHP rẹ pọ si fun awọn ẹrọ alagbeka ati Atọka Akọkọ Google Mobile laisi nini lati ṣe eto ẹya AMPHflix tirẹ fun oju-iwe rẹ kọọkan!

Ṣe idanwo: Fi sori ẹrọ. Muu ṣiṣẹ. Pari!


Ipolowo

Fi ohun itanna AMP PHP sii


description

Imọran ṣaaju ki o to bẹrẹ fifi sori ẹrọ PHP-AMP plug-in: Fun diẹ ninu awọn solusan CMS, amp-cloud.de nfunni ni awọn afikun plug-in AMP Google pataki paapaa rọrun lati fi sii ati ṣakoso! -Gẹgẹbi omiiran si “AMP fun plug-in PHP” , ọkan ninu awọn afikun AMP Google atẹle wọnyi le jẹ anfani si ọ:


Igbesẹ-1: Ṣe igbasilẹ “AMP fun Plugin PHP”

Ṣe igbasilẹ ẹya tuntun “AMP fun PHP Plugin” bi faili ZIP kan lati ọna asopọ igbasilẹ atẹle naa. - Faili ZIP ni folda kan ti a pe ni “amp” eyiti o ni gbogbo awọn faili ti o nilo lati fi sii ati lo afikun AMP.


Igbesẹ-2: Jade “AMP fun Ohun itanna PHP” -ZIP-faili

Unzip / jade faili ZIP ti o gbasilẹ.

  • Lẹhin ti ṣiṣi / jade o yẹ ki o ni bayi ni “folda” pẹlu orukọ “/ amp /“ ninu eyiti awọn faili ohun itanna PHP-AMP wa.

Igbesẹ-3: Fipamọ awọn faili ohun itanna PHP lori olupin ayelujara

Ṣe igbasilẹ folda ti a ko ṣii pẹlu orukọ "/ amp /" sinu itọsọna gbongbo ti olupin wẹẹbu rẹ ki folda naa le de lori oju opo wẹẹbu rẹ labẹ URL atẹle:

  • www.DeineDomain.de/amp/

Lati ṣe idanwo boya folda ti wa ni fipamọ daradara lori olupin wẹẹbu rẹ, kan pe URL atẹle naa-Ti fifi sori ẹrọ ba pe, o yẹ ki o wo ifiranṣẹ kan ti o sọ fun ọ pe oju opo wẹẹbu rẹ nlo plug-in AMP lati amp-cloud.de, bibẹkọ ti ohun itanna ko fi sii ni deede ati pe o yẹ ki o tun lọ nipasẹ awọn igbesẹ ti o wa loke lẹẹkansi:

  • www.DeineDomain.de/amp/amp.php
    (Dajudaju o ni lati rọpo www.yourdomain.de pẹlu adirẹsi ti oju opo wẹẹbu rẹ)

Igbesẹ-4: fi aami AMPHTML sii!

Ni ikẹhin, pẹlu titari ipilẹ kọọkan , fun eyiti o fẹ pese ẹya AMP, ni lilo ọkan ninu awọn iyatọ atẹle wọnyi <ọna asopọ rel = "amphtml"> - ọjọ kan ni <ori> apakan ti ipilẹ ti o baamu.

  • Ẹya 1:

    <ọna asopọ rel = "amphtml" href = "http: // www.DeineDomain.de /amp/amp.php?url= IhrArtikelURL " />
    • Rọpo “http: //” apakan pẹlu “https: //” ti o ba nlo HTTPS lori oju opo wẹẹbu rẹ
    • Rọpo apakan “www.yourdomain.de” pẹlu aaye ti oju opo wẹẹbu rẹ
    • Rọpo apakan “URL Abala Nkan Rẹ” pẹlu URL ti a fi koodu UTF8 kan ti oju-iwe abẹlẹ oniwun eyiti o pẹlu tag AMPHTML (pẹlu “Http: //” tabi “https: //”)

      Lati ṣafikun URL kan ni deede, o le lo koodu iwọle URL ori ayelujara atẹle, fun apẹẹrẹ: https://www.url-encode-online.rocks/

      Apẹẹrẹ fun URL ti o ni koodu UTF-8:
      https% 3A% 2F% 2F www.DeineDomain.de% 2FDeinPfad% 2FDeineDatei.php% 3Fparameter% 3DS% C3% BC% C3% 9F% 26sprache% 3DDE

      Apẹẹrẹ fun URL ti a pinnu URL UTF-8:
      https://www.DeineDomain.de/DeinPfad/DeineDatei.php?parameter=Süß&sprache=DE

  • Iyatọ 2:

    <ọna asopọ rel = "amphtml" href = " http: // ". $ _ SERVER ['HTTP_HOST']. "/ amp / amp.php? url =". urlencode (" http: // ". $ _ SERVER [ 'HTTP_HOST']. $ _ Olupin ['PHP_SELF']. "?". $ _ SERVER ['QUERY_STRING']. ""). "" />
    • Ti o ba lo HTTPS lori oju opo wẹẹbu rẹ, rọpo awọn ẹya meji "http: //" pẹlu "https: //"

AMP PHP koodu apẹẹrẹ


code
<?php echo " <!DOCTYPE html> <html> <head> <title> Akọle meta rẹ ... </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> Koodu orisun ara re ... </body> </html> ;" ?>

Kini idi ti o lo ohun itanna PHP AMP?


power

AMP osise fun ohun itanna PHP lati amp-cloud.de n mu Awọn oju-iwe Alailowaya Alailowaya (AMP) ṣiṣẹ lori awọn oju opo wẹẹbu PHP tirẹ, taara labẹ agbalejo tirẹ, bi iṣeduro nipasẹ awọn itọsọna alejo AMP ti Google!


Ipolowo