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

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

0c9a69560f916778b569086d792680bb?s=128

bmf_san

June 29, 2019
Tweet

Transcript

  1. 4.
  2. 21.

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

    GET/POST… Output • Action • ॲཧ • ex. PostController@getPosts • Parameters • ύεύϥϝʔλʔ • ex. /boo/bar/:id
  3. 23.

    Routing Mapͱ͸ • Routing Map • ϧʔςΟϯάͷͨΊͷσʔλߏ଄ • Router͕಺෦తʹ࣋ͭ •

    ϧʔςΟϯάͷఆ͔ٛΒੜ੒͞ΕΔ • URLͱ࣮ߦ͍ͨ͠ॲཧΛϚοϐϯά
  4. 24.

    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. 25.

    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
  6. 27.

    σʔλߏ଄ 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
  7. 30.

    UPLFO &/%@10*/5 &/%@10*/5 &/%@10*/5 &/%@10* /5 QSPpMF  DBUFHPSZ &/%@10*/5

    QPTUT JE &/%@10*/5 (&5QPTUT 
  8. 31.

    UPLFO &/%@10*/5 &/%@10*/5 &/%@10*/5 &/%@10* /5 QSPpMF  DBUFHPSZ &/%@10*/5

    QPTUT JE &/%@10*/5 (&5QPTUT 
  9. 32.

    UPLFO &/%@10*/5 &/%@10*/5 &/%@10*/5 &/%@10* /5 QSPpMF  DBUFHPSZ &/%@10*/5

    QPTUT JE &/%@10*/5 (&5QPTUT 
  10. 33.

    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΋Ұॹʹฦ͢
  11. 35.
  12. 36.
  13. 40.
  14. 43.
  15. 44.

    ՝୊ • ΤϥʔϋϯυϦϯά • ࣮ӡ༻ʹ޲͚ͨػೳ։ൃ • ϛυϧ΢ΣΞͷͭͳ͗ࠐΈ • ύεύϥϝʔλʹਖ਼نදݱ͕࢖͑Δ •

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