I-PHP: Zingaphi iintsuku kude kube yiKrisimesi?

Inja yeKrisimesiSinomthengi okhethekileyo olungileyo kuphela kude kube yiKrisimesi kunye nokuseta kweentsuku kude kube kuphelelwa ngumhlaba ogcinwe kwindawo yogcino lwedatha.

Ndidinga ukubhala umsebenzi wekron (umsebenzi ocwangcisiweyo) ohlaziya umhlaba kwindawo nganye yokutyela ngobusuku. Andizange ndibhale nayiphi na imisebenzi ye-cron ngaphambili-enkosi kwiqabane lam, Tim, e Immax ngokundikhokelela kwicala elilungileyo. Ndikhe ndayifumana nge-imeyile kusasa ukuze indazise ukuba iphumelele.

Ngapha koko, ndicinge ukuba ndiyibhalile ikhowudi nangayiphi na indlela, ndingabelana ngolonwabo kwaye ndiyikhuphele nina bantu.

Inyanga yeedola = 12;
Usuku lweedola = 25;
$ unyaka = umhla ("Y");
Iintsuku zeedola = (int) ((mktime (0,0,0, inyanga yeedola, usuku lwedola, unyaka wonyaka) -ixesha (akukho)) / 86400);
ukuba (iintsuku zeedola> 0) {
$ Unyaka = $ Unyaka + 1;
Iintsuku zeedola = (int) ((mktime (0,0,0, inyanga yeedola, usuku lwedola, unyaka wonyaka) -ixesha (akukho)) / 86400);
}
tshintsha (iintsuku zeedola) {
ityala 0:
echo "Ikrisimesi emnandi!";
ikhefu;
ityala 1:
sitsho "Ngubusuku beKrisimesi!";
ikhefu;
ukusilela:
phendula "Kukho". $ iintsuku. "iintsuku ezininzi kude kube yiKrisimesi!";
}

Lumka ikopi kwaye uncamathisele iposti, ngamanye amaxesha i-apostrophes iyaphazamiseka. Ukuba uneWordPress, ungayifaka le nto kwikhowudi yephepha lakho kwaye uyibonise. Andiqinisekanga ukuba wonk 'ubani unomdla malunga neKrisimesi kuphela emva kweentsuku ezingama-48, kodwa yintoni le ayithandayo!

Ukuba ubufuna njalo, unokwakha ingxelo yetyala kwaye wenze iintsuku ezili-12 zeKrisimesi. 🙂

Le khowudi ikwathathela ingqalelo unyaka, ke kunyaka olandelayo izakuqhubeka nokusebenza!

4 Comments

  1. 1
  2. 3

    Molo Doug,

    Enkosi ngale snippet yekhowudi. Ndizama ukuyibeka kwibarbar esecaleni njengewijethi. Ndiyincamathisele ikhowudi kwaye ibonisa ikhowudi eluhlaza kwiphepha .. Ukungabi yi-wizard ye-php .. Ngaba ikhona indlela "elula" yokwenza ukuba isebenze?

    Enkosi,
    Dan

Ingaba ucinga ntoni?

Le sayithi isebenzisa i-Akismet ukunciphisa ugaxekile. Funda indlela idatha yakho yokubhaliweyo isetyenziswe ngayo.