Yuav Ua Li Cas Los Ua Cov Ntawv Sau

Cov txheej txheem:

Yuav Ua Li Cas Los Ua Cov Ntawv Sau
Yuav Ua Li Cas Los Ua Cov Ntawv Sau

Video: Yuav Ua Li Cas Los Ua Cov Ntawv Sau

Video: Yuav Ua Li Cas Los Ua Cov Ntawv Sau
Video: Yuav kov li cas thiaj ua tau rau poj niam paum los kua tau 26/9/2020 2024, Kaum ib hlis
Anonim

Cov lus txhais tiag tiag, lo lus txhais tau tias "sau", uas yog, piav qhia txog ntu ntawm kev nqis tes ua uas xav tau los ua kom tiav ib qho haujlwm tshwj xeeb. Hais txog kev siv Internet, cov haujlwm no tuaj yeem yog, piv txwv li, nthuav qhia lub moos ntawm nplooj ntawv Internet, siv ntau yam cuam tshuam nrog pom duab nrog duab, thiab lwm yam. Thiab cov zaub hauv qhov browser ntawm nplooj ntawv nws tus kheej ntawm lub network niaj hnub no tseem ua tau raws li cov lus sau hauv tsab ntawv. Cia peb sim sau ob peb tsab ntawv yooj yim kom tau ib lub tswv yim ntawm lawv yog.

Sau ntawv li cas
Sau ntawv li cas

Cov Lus Qhia

Kauj ruam 1

Nyob ntawm seb qhov twg cov ntawv raug tua, cov ntawv sau tau muab faib ua "cov neeg siv" thiab "server". Mus rau qee qhov chaw nyob hauv lub network, peb xa qhov URL ntawm nplooj ntawv nyiam rau lub server, thiab lub server ntawd sau cov ntawv (tsab ntawv) nyob rau ntawm qhov chaw nyob. Cov ntawv sau, ua yeeb yam rau cov kev ua nyob hauv nws ntawm tus neeg rau zaub mov, sau nplooj ntawv los ntawm cov khoom tsim nyog thiab xa mus rau qhov browser. Nov yog tsab ntawv rau neeg rau zaub mov. Tau txais nplooj ntawv, qhov browser ntawm peb lub khoos phis tawm xa nws rau peb, thiab yog tias muaj ntawv sau nyob hauv nplooj ntawv tau txais cov cai, ces nws twb ua tiav cov ntawv no. Nov yog neeg siv tsab ntawv.

Txog ntawm tus server lossis browser txhawm rau nyeem, nkag siab thiab tsim nqe ntawv, nws yuav tsum sau thiab sau raws li cov cai uas lawv paub. Cov kev cai zoo li no hu ua cov lus scripting. Feem ntau cov ntawv sau lub server sab tam sim no sau nyob rau hauv PHP, thiab feem ntau cov neeg siv sab sau ntawv yog sau ua lus JavaScript. Txhawm rau sau tsab ntawv ntawm koj tus kheej, nws txaus los muaj ib tus ntawv xov xwm dog dig - notepad. Tab sis rau cov programmes tas li ntawm cov ntawv sau, koj tsis tuaj yeem ua yam tsis muaj tus kws kho tshwj xeeb. Tus kws kho sau ntawv tshaj tawm txoj kab ntawm tsov ntxhuav txoj haujlwm ntawm cov haujlwm niaj hnub ntawm kev sau ntawv sau, sau tus programmer sijhawm ntau dua rau kev tsim.

Cia peb sau cov ntawv sau yooj yim ntawm cov lus server-sab PHP. Thawj kab yog qhia rau tus neeg ua yeeb yam tias tsab ntawv pib txij no. Hauv PHP, qhov qhib pib no zoo li qhov no: Ntawm ob lub cim no yog cov lus qhia - cov neeg ua haujlwm hais lus. Piv txwv li, kev qhia los sau cov ntawv sau sab laug ntawm O. Bender ntawm Caucasian Pob Zeb yog sau zoo li no: ncha ("Kisya thiab Osya tau nyob ntawm no"); Thiab cov kev qhia los qhia lub sijhawm tam sim no nyob rau hauv hom HOUR: MINUTE yog sau zoo li qhov no: hnub ncha ('H: i'); Cov ntawv sau ua tiav PHP ua tiav ntawm cov nqe lus no yuav zoo li no: <? phpecho ("B");

hnub ncha ('H: i');

ncha ("Kisya thiab Osya nyob ntawm no!");?> Tom qab sau cov ntawv no los ntawm cov program neeg rau zaub mov (tus neeg txhais lus), nplooj ntawv yuav zoo li no:

Tus neeg rau zaub mov sau tiav ua tiav
Tus neeg rau zaub mov sau tiav ua tiav

Kauj ruam 2

Thiab tib tsab ntawv hauv neeg siv sab JavaScript yuav zoo li no: var tam sim no = hnub tshiab ();

daim ntawv sau.is ntawv ("B");

daim ntawv sau.write (now.getHours () + ":" + now.getMinutes ());

cov ntawv sau.write ("Kisya thiab Osya nyob ntawm no!"); Ntawm no kab var tam sim no = hnub tshiab () qhia cov neeg sau ntawv kom tsim ib qho tshiab virtual khoom npe "tam sim no", uas sawv cev tam sim no hnub thiab sijhawm. document.write () yog ib qhov lus txib kom sau nyob rau hauv nplooj ntawv dab tsi uas qhia nyob rau hauv kev thaiv kab, thiab tam sim no.

Nws tseem nyob rau qhov pom tseeb ntau dua los muab ob tsab ntawv no tso rau hauv ib qho ntaub ntawv, khaws nws ntawm tus neeg rau zaub mov thiab ntaus qhov URL hauv qhov chaw nyob ntawm qhov browser. Yog li ntawd, peb yuav pom tib txoj kab, ib qho ntawm cov tau ua tiav raws li peb tsab ntawv ntawm lub server (tus neeg txhais lus PHP), thiab lwm yam nyob hauv peb lub khoos phis tawm (JavaScript tus neeg txhais lus).

Pom zoo: