jsj_PHP 高级

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

PHP1,PHPDate():PHPDate().:date(format,timestamp)formattimestamp.....2,PHP-(Timestamp)?:197011(00:00:00GMT).Unix(UnixTimestamp).3,PHP-:date()/..:d-(01-31);:?phpechodate(Y/m/d);echo;echodate(Y.m.d);echo;echodate(Y-m-d);?:2006/07/112006.07.112006-07-114,PHP-:date()..,.,mktime().mktime()Unix.::mktime(hour,minute,second,month,day,year,is_dst),mktime()day:?php$tomorrow=mktime(0,0,0,date(m),date(d)+1,date(Y));echoTomorrowis.date(Y/m/d,$tomorrow);?:2006/07/125,(SSI),,.6,(ServerSideIncludes):include()require(),PHP.,.include()(),require()(fatalerror)().,,...,,,().7,include():include(),include.1:,header.php.,include(),:m-,(01-12);Y-()PHPDate,.,/,.-,?phpinclude(header.php);?1WelcometomyhomepageSometext2:,.menu.php:Home|AboutUs|ContactUs,.:,default.php,about.phpcontact.phpmenu.php.default.php:,?phpinclude(menu.php);?WelcometomyhomepageSometextdefault.php,:Home|AboutUs|ContactUsWelcometomyhomepageSometext,,about.phpcontact.php.,,,menu.php.8,require():require()include(),.include()(),require()(fatalerror)().include(),:PHP::?phpinclude(wrongFile.php);echoHelloWorld!;?2::Warning:include(wrongFile.php)[function.include]:failedtoopenstream:NosuchfileordirectoryinC:\home\website\test.phponline5Warning:include()[function.include]:Failedopening'wrongFile.php'forinclusion(include_path='.;C:\php5\pear')inC:\home\website\test.phponline5HelloWorld!,echo!.,require().PHP::?phprequire(wrongFile.php);echoHelloWorld!;?::Warning:require(wrongFile.php)[function.require]:failedtoopenstream:NosuchfileordirectoryinC:\home\website\test.phponline5Fatalerror:require()[function.require]:Failedopeningrequired'wrongFile.php'(include_path='.;C:\php5\pear')inC:\home\website\test.phponline5,echo.,require()include().9,:fopen()PHP.,:?php$file=fopen(welcome.txt,r);?:3rr+ww+a../...;,./.;,..,,.a+xx+/.,...,FALSE./..,FALSE.:fopen(),0(false).:fopen(),:?php$file=fopen(welcome.txt,r)orexit(Unabletoopenfile!);?10,:fclose().?php$file=fopen(test.txt,r);//somecodetobeexecutedfclose($file);?11,End-of-file:feof()(EOF).,feof().::w,ax,!if(feof($file))echoEndoffile;12,:fgets().::,.::,:?php$file=fopen(welcome.txt,r)orexit(Unabletoopenfile!);//Outputalineofthefileuntiltheendisreachedwhile(!feof($file)){echofgets($file).;}fclose($file);413,:fgetc().::,.::,:?php$file=fopen(welcome.txt,r)orexit(Unabletoopenfile!);while(!feof($file)){echofgetc($file);}fclose($file);?14,:.HTML:Filename::enctype.,,multipart/form-data.type=file.,,.::..15,upload_file.php:?phpif($_FILES[file][error]0){echoError:.$_FILES[file][error].;}else{echoUpload:.$_FILES[file][name].;echoType:.$_FILES[file][type].;echoSize:.($_FILES[file][size]/1024).Kb;echoStoredin:.$_FILES[file][tmp_name];}?PHP$_FILES,.inputname,name,type,size,tmp_nameerror.:$_FILES[file][name]-$_FILES[file][type]-5$_FILES[file][size]-,,$_FILES[file][tmp_name]-$_FILES[file][error]-.,.16,:,..gif.jpeg,20kb:?phpif((($_FILES[file][type]==image/gif)||($_FILES[file][type]==image/jpeg)||($_FILES[file][type]==image/pjpeg))&&($_FILES[file][size]20000)){if($_FILES[file][error]0){echoError:.$_FILES[file][error].;}else{echoUpload:.$_FILES[file][name].;echoType:.$_FILES[file][type].;echoSize:.($_FILES[file][size]/1024).Kb;echoStoredin:.$_FILES[file][tmp_name];}}else{echoInvalidfile;}?::IE,jpgpjpeg,FireFox,jpeg.17,:PHP..,:?phpif((($_FILES[file][type]==image/gif)||($_FILES[file][type]==image/jpeg)||($_FILES[file][type]==image/pjpeg))&&($_FILES[file][size]20000)){if($_FILES[file][error]0){echoReturnCode:.$_FILES[file][error].;}else{echoUpload:.$_FILES[file][name].;echoType:.$_FILES[file][type].;echoSize:.($_FILES[file][size]/1024).Kb;echoTempfile:.$_FILES[file][tmp_name].;if(file_exists(upload/.$_FILES[file][name])){echo$_FILES[file][name].alreadyexists.;6}else{move_uploaded_file($_FILES[file][tmp_name],upload/.$_FILES[file][name]);echoStoredin:.upload/.$_FILES[file][name];}}}else{echoInvalidfile;}?,,.::upload.18,Cookie?:cookie.cookie.,cookie.PHP,cookie.19,cookie?:setcookie()cookie.:setcookie().:::setcookie(name,value,expire,path,domain);::,usercookie,AlexPorter.cookie:?phpsetcookie(user,AlexPorter,time()+3600);?:cookie,cookieURL,(URL,setrawcookie():).20,Cookie?:PHP$_COOKIEcookie.,usercookie,:?php//Printacookieecho$_COOKIE[user];//Awaytoviewallcookiesprint_r($_COOKIE);?,isset()cookie:?phpif(isset($_COOKIE[user]))echoWelcome.$_COOKIE[user].!;elseechoWelcomeguest!;?721,cookie?:cookie,.:?php//settheexpirationdatetoonehouragosetcookie(user,,time()-3600);?22,cookie?:cookie,.(,).welcome.php:Name:Age:welcome.php,:Welcome?phpecho$_POST[name];?.Youare?phpecho$_POST[age];?yearsold.23,PHPsession,.Session,.24,PHPSession:,,,...,.,:,HTTP.,PHPsession(,).,,.,.Session:id(UID),UID.UIDcookie,URL.25,PHPSession:PHPsession,.::session_start():?phpsession_start();?,,UID.26,Session:sessionPHP$_SESSION:?phpsession_start();//storesessiondata$_SESSION['views']=1;??php//retrievesessiondata8echoPageviews=.$_SESSION['views'];?:Pageviews=1,page-view.isset()views.views,.views,views,1:?phpsession_start();if(isset($_SESSION['views']))$_SESS

1 / 25
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功