Vim li cas peb thiaj xav tau kev sib tham hauv PHP?
Vim li cas peb thiaj xav tau kev sib tham hauv PHP?

Video: Vim li cas peb thiaj xav tau kev sib tham hauv PHP?

Video: Vim li cas peb thiaj xav tau kev sib tham hauv PHP?
Video: BABY XAV NTSIB KOJ (BABY I WANNA MEET YOU) - NT ONE [OFFICIAL MUSIC VIDEO] | HMONG NEW SONG 2023 2024, Hlis ntuj nqeg
Anonim

Sessions yog ib txoj hauv kev yooj yim los khaws cov ntaub ntawv rau ib tus neeg siv tawm tsam ib qho tshwj xeeb kev sib tham ID. Qhov no ua tau siv los txuas ntxiv lub xeev cov ntaub ntawv ntawm nplooj ntawv thov. Kev sib tham IDs yog nquag xa mus rau lub browser ntawm kev sib tham ncuav qab zib thiab ID yog siv toretrieve uas twb muaj lawm kev sib tham cov ntaub ntawv.

Tib neeg kuj nug, lub hom phiaj ntawm Session hauv PHP yog dab tsi?

PHP - Kev sib tham . Kev tshaj tawm. Lwm txoj hauv kev los ua kom cov ntaub ntawv nkag mus tau thoob plaws ntau nplooj ntawv ntawm tag nrho lub vev xaib yog mus siv a PHP Session . A kev sib tham tsim ib cov ntaub ntawv nyob rau hauv ib ntus directory ntawm lub server qhov twg sau npe kev sib tham variables thiab lawv cov nqi khaws cia.

Ib yam li ntawd, kuv yuav pib qhov kev sib tham PHP li cas? Ua ntej koj tuaj yeem khaws cov ntaub ntawv hauv kev sib tham variables, koj yuav tsum xub pib up lub kev sib tham . Rau pib ib new kev sib tham , tsuas yog hu rau PHP session_start() muaj nuj nqi. Nws yuav tsim ib qho tshiab kev sib tham thiab tsim ib qho tshwj xeeb kev sib tham ID rau tus neeg siv. Cov PHP code hauv qhov piv txwv hauv qab no tsuas yog pib ib qho tshiab kev sib tham.

Ib yam li ntawd, kev sib tham ua haujlwm li cas hauv PHP?

Kev sib tham hauv PHP pib los ntawm kev siv session_start() muaj nuj nqi.

Hauv qhov xwm txheej dav dav:

  1. qhov kev sib kho id raug xa mus rau tus neeg siv thaum nws qhov kev sib kho tau tsim.
  2. nws khaws cia rau hauv lub ncuav qab zib (hu ua, los ntawm lub neej ntawd, PHPSESSID)
  3. cov kua nplaum uas tau xa los ntawm browser mus rau lub server nrog txhua qhov kev thov.

Dab tsi yog qhov kev sib tham thiab ncuav qab zib hauv PHP?

A kev sib tham yog qhov hloov pauv thoob ntiaj teb khaws cia ntawm lub server. Txhua kev sib tham yog muab ib tug tshwj xeeb id uas yog siv los retrieve khaws qhov tseem ceeb. Kev sib tham muaj peev xwm khaws cov ntaub ntawv loj heev piv rau ncuav qab zib . Cov kev sib tham Qhov tseem ceeb yuav raug rho tawm thaum lub browser kaw.

Pom zoo: