您好,欢迎访问三七文档
当前位置:首页 > 建筑/环境 > 电气安装工程 > jsj_php_面试常用题目
PHP2006-5-1022:21:21(2)echodate('Y-m-dH:i:s',strtotime('-1day'));echodate('Y-n-jH:i:s',time()-60*60*24);2echo(),print(),print_r()(3)echo,printprint_rechoechoPHP,printprint_r,,printecho($b?printtrue:printfalse;)print(int,string)print_r(,)3HTMLPHP(1)smarty5(1)SVNCVS6(3)stringstrrev(stringstring)(?php$str='test';for($i=1;$i=strlen($str);$i++){echosubstr($str,-$i,1);}7MYSQL(4)(1).(2).JOIN(Sub-Queries)(3).(UNION)8PHP(1)PHP:HypertextPreporcessor(Preprocessor)9MYSQL?(2)NOW()FOMART_DATE()now(),DATE_FORMAT(date,format)10(3)mb_substr()mb_substr('',0,7,'utf-8');//echomb_strcut('',0,7,'utf-8');//ord2311??(1)SVNCVS.12??(1)PHPLIBITFlexySmarty13(4)14,?(4)ab.()c.php15PHPIPIP1)$serverip=gethostbyname($_SERVER['SERVER_NAME']);functionreal_ip(){if(isset($_SERVER)){if(isset($_SERVER[HTTP_X_FORWARDED_FOR])){$arr=explode(',',$_SERVER[HTTP_X_FORWARDED_FOR]);/*X-Forwarded-ForunknownIP*/foreach($arrAS$ip){$ip=trim($ip);if($ip!='unknown'){$realip=$ip;break;}}}elseif(isset($_SERVER[HTTP_CLIENT_IP])){$realip=$_SERVER[HTTP_CLIENT_IP];}else{$realip=$_SERVER[REMOTE_ADDR];}}else{if(getenv('HTTP_X_FORWARDED_FOR')){$realip=getenv('HTTP_X_FORWARDED_FOR');}elseif(getenv('HTTP_CLIENT_IP')){$realip=getenv('HTTP_CLIENT_IP');}else{$realip=getenv('REMOTE_ADDR');}}return$realip;}16includerequire?(?)?(2)includerequireinclude_once,require_once17SESSION(1).session_set_cookie_params();session_set_cookie_params();18,PHP:($1)file_get_contents();file_get_contents($url)19HTTP1.0401(?)header(?);(2)401Unauthorized;header('HTTP/1.1404NotFound');20PHPheredoc?(1)21asp,php,jsp(1)21mvc(1)22SQLmembers(id,username,posts,pass,email)(2)select*from`members`orderby`posts`limit10;selectmembers.usernamefrommembersorderbypostsDESClimit1023.php(2)24.PHPerror_reporting(1)25.(2)functionisEmail($str){returnereg('^[-_\.a-zA-Z0-9]+@[-a-zA-Z0-9]+\.[-\.a-zA-Z0-9]+$',$str);}$ismail=(preg_match(/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/,$Email))?'Yse':'No';26.(2)REQUEST_URIecho$_SERVER['scrīpt_FILENAME'].?.$_SERVER['QUERY_STRING'];27.SESSION.(1)session_start();//$lifeTime=24*3600;setcookie(session_name(),session_id(),time()+$lifeTime,/);21JS??(2)alert(),prompt(),confirm()--focus()22JS?JS?(2)target.location.href23foo()@foo()(1)@24myclass”(1)classmyclass{};25myclass”(1)$newClass=newmyclass();26(2)-$newClass=newmyclass();$testVar=$newClass-test;$newClass-test=mystring;27mysql_fetch_row()mysql_fetch_array(1)mysql_fetch_row--mysql_fetch_array--28GD(1)GD29PHPHTML(1)echo;print();30(1)(c)(a)fget()(b)file_open()(c)fopen()(d)open_file()31johnusers(1)(c)(d)(a)$users[]=‘john’;(b)array_add($users,’john’);(c)array_push($users,‘john’);(d)$users||=‘john’;32?(1)?php$num=10;functionmultiply(){$num=$num*10;}multiply();echo$num;33php(2)UserNameTelContentDate133336633662006-10-11136123123312006-10-15021-556655662006-10-15$mysql_db=mysql_connect(local,root,pass);@mysql_select_db(DB,$mysql_db);$result=mysql_query('select*from`user`where`name`=\'\'');while($row=mysql_fetch_array($result)){echo'name:'.$row['name'].'tel:'.$row['tel'].'';}$mysql_db=mysql_connect(local,root,pass);@mysql_select_db(DB,$mysql_db);$result=mysql_query(select*fromUserwhereName='');while($row=mysql_fetch_array($result)){echo$row['Name'].$row['Tel'].$row['Content'].$row['Date'];echo;}34,?(3)classtest{functionGet_test($num){$num=md5(md5($num).En);return$num;}}md5$testObject=newtest();$encryption=$testObject-Get_test(xiaotian_ls);35SQL:(4)UserNameTelContentDate133336633662006-10-11136123123312006-10-15021-556655662006-10-15(a)(132547485472007-05-06)SQL(b)sql(c)(a)(132547485472007-05-06)SQLINSERTINTOUser('Name','Tel','Content','Date')VALUES('','13254748547','','2007-05-06')(b)sqlUPDATEUserSETDate=DATE_FORMAT(NOW(),'%Y-%m-%d')WHEREName=''(c)DELETEFROMUserWHEREName=''36(intcharvarchardatetimetext);varcharchar(2)37MySQ(ID)(?)(1)38(1)4?$b=201;$c=40;$a=$b$c?4:5;echo$a;39??(2)40?(1)count()41$arr=array('james','tom','symfony');(1)print$arr[0];4241','(1)print$arr[0].,$arr[1].,$arr[2];//^_^$arr1=implode(,,$arr);43$a='abcdef';$a(1)printsubstr($a,0,1);44PHPsqlserver/oracle?(1)45PHP5(3)46php5(2)47PHPMYADMIN()message(3)ididtitlecontentcategory_ididhitsCreatetablemessage(idintauto_incrementprimarykey,titlevarchar(50)notnull,contenttextnotnull,category_idsmallintdefault1,hitsintnotnull)()comment(4)comment_ididididmessageidcomment_content,idSQL0()category(3)category_idint(4)notnullauto_increment;categroy_namevarchar(40)notnull;PHP(100/47)PHP100(50)1PHP2006-5-1022:21:21(2)2echo(),print(),print_r()(3)3HTMLPHP(1)5(1)6(3)7MYSQL(4)8PHP(1)9MYSQL?(2)10(3)11??(1)12??(1)13(4)14,?(4)15PHPIPIP1)16includerequire?(?)?(2)17SESSION(1).18,PHP:($1)19HTTP1.0401(?)header(?);(2)20.SESSION.(1)21JS??(2)22JS?JS?(2)23foo()@foo()(1)24myclass”(1)25myclass”(1)26(2)27mysql_fetch_row()mysql_fetch_array(1)28GD(1)29PHPHTML(1)30(1)(a)fget()(b)file_open()(c)fopen()(d)open_file()31johnusers(1)(a)$users[]=‘john’;(b)array_add($users,’john’);(c)array_push($users,‘john’);(d)$users||=‘john’;32?(1)?php$num=1
本文标题:jsj_php_面试常用题目
链接地址:https://www.777doc.com/doc-6226095 .html