Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥

PHPでURLルーティングを自作する

bmf_san
June 29, 2019

 PHPでURLルーティングを自作する

bmf_san

June 29, 2019
Tweet

More Decks by bmf_san

Other Decks in Programming

Transcript

  1. I/O Input • Path • /foo/bar/1 • HTTP Method •

    GET/POST… Output • Action • ॲཧ • ex. PostController@getPosts • Parameters • ύεύϥϝʔλʔ • ex. /boo/bar/:id
  2. Routing Mapͱ͸ • Routing Map • ϧʔςΟϯάͷͨΊͷσʔλߏ଄ • Router͕಺෦తʹ࣋ͭ •

    ϧʔςΟϯάͷఆ͔ٛΒੜ੒͞ΕΔ • URLͱ࣮ߦ͍ͨ͠ॲཧΛϚοϐϯά
  3. Routing 1BUI .FUIPE "DUJPO  (&5 *OEFY$POUSPMMFS!JOEFY QPTUT (&5 1PTU$POUSPMMFS!HFU1PTUT

    QPTUTJE (&5 1PTU$POUSPMMFS!FEJU QPTUTJE 1045 1PTU$POUSPMMFS!VQEBUF QPTUTJEUPLFO (&5 1PTU$POUSPMMFS!QSFWJFX QPTUTDBUFHPSZ (&5 1PTU$POUSPMMFS!HFU1PTUT#Z$BUFHPSZ QSPpMF (&5 1SPpMF$POUSPMMFS!HFU1SPpMF
  4. Routing 1BUI .FUIPE "DUJPO  (&5 *OEFY$POUSPMMFS!JOEFY QPTUT (&5 1PTU$POUSPMMFS!HFU1PTUT

    QPTUTJE (&5 1PTU$POUSPMMFS!FEJU QPTUTJE 1045 1PTU$POUSPMMFS!VQEBUF QPTUTJEUPLFO (&5 1PTU$POUSPMMFS!QSFWJFX QPTUTDBUFHPSZ (&5 1PTU$POUSPMMFS!HFU1PTUT#Z$BUFHPSZ QSPpMF (&5 1SPpMF$POUSPMMFS!HFU1SPpMF
  5. σʔλߏ଄ 1BUI .FUIPE "DUJPO  (&5 *OEFY$POUSPMMFS!JOEFY QPTUT (&5 1PTU$POUSPMMFS!HFU1PTUT

    QPTUTJE (&5 1PTU$POUSPMMFS!FEJU QPTUTJE 1045 1PTU$POUSPMMFS!VQEBUF QPTUTJEUPLFO (&5 1PTU$POUSPMMFS!QSFWJFX QPTUTDBUFHPSZ (&5 1PTU$POUSPMMFS!HFU1PTUT#Z$BUFHPSZ QSPpMF (&5 1SPpMF$POUSPMMFS!HFU1SPpMF
  6. UPLFO &/%@10*/5 &/%@10*/5 &/%@10*/5 &/%@10* /5 QSPpMF  DBUFHPSZ &/%@10*/5

    QPTUT JE &/%@10*/5 (&5QPTUT 
  7. UPLFO &/%@10*/5 &/%@10*/5 &/%@10*/5 &/%@10* /5 QSPpMF  DBUFHPSZ &/%@10*/5

    QPTUT JE &/%@10*/5 (&5QPTUT 
  8. UPLFO &/%@10*/5 &/%@10*/5 &/%@10*/5 &/%@10* /5 QSPpMF  DBUFHPSZ &/%@10*/5

    QPTUT JE &/%@10*/5 (&5QPTUT 
  9. UPLFO &/%@10*/5 &/%@10*/5 &/%@10*/5 &/%@10* /5 QSPpMF  DBUFHPSZ &/%@10*/5

    QPTUT JE &/%@10*/5 (&5QPTUT  (&51PTU$POUSPMMFS!HFU1PTUT 10451PTU$POUSPMMFS!FEJU )551ϝιουʹԠͯ͡ॲཧΛৼΓ෼͚ ˞QBSBNFUFST΋Ұॹʹฦ͢
  10. ՝୊ • ΤϥʔϋϯυϦϯά • ࣮ӡ༻ʹ޲͚ͨػೳ։ൃ • ϛυϧ΢ΣΞͷͭͳ͗ࠐΈ • ύεύϥϝʔλʹਖ਼نදݱ͕࢖͑Δ •

    ͦͷଞศརػೳͱ͔ • ࣮ߦ଎౓ͷߟྀ • ໦ߏ଄ɺจࣈྻ୳ࡧΞϧΰϦζϜ