文档介绍:PHP面试题答案1、求$a,$b,$c三个数中的最大值和最小值(5分)echomax($a,$b,$c);echomin($a,$b,$c);2、echo()、print()、print_r()的区别(5分)print()   只能打印出简单类型变量的值(如int,string) print_r()可以打印出复杂类型变量的值(如数组,对象) echo    输出一个或者多个字符串3、防止SQL注入漏洞可以用哪些函数?(5分)addslashes()mysql_escape_string()正确回答1个即可4、用PHP写出显示客户端IP与服务器IP的代码(5分)echo$_SERVER[‘REMOTE_ADDR’];echo$_SERVER[‘SERVER_ADDR’];5、用PHP打印出前一天的时间,格式例如2006-5-1022:21:21(10分)strftime(“%Y-%m-%d%T”,strtotime(“-1day”));date(“Y-m-dH:i:s”,strtotime(“-1day”));正确回答1个即可6、写一个函数,能够遍历一个文件夹下的所有文件和子文件夹(20分)functiondir_recurse($dir){$i=1;if($handle=opendir($dir)){while(false!==($file=readdir($handle))){if($file!="."&&$file!=".."){if(is_dir($dir."/".$file)==true){$fullpath=$dir."/".$file;dir_recurse($fullpath);echo"$fullpath\n";$i++;}else{$fullpath=$dir."/".$file;echo"$fullpath\n";$i++;}}}closedir($handle);}}7、创建文件exer1,设置访问权限为rw-r--r--,现要增加所有用户的执行权限和同组用户的写权限,写出操作过程的命令(10分)touchexer1chmod644exer1增加权限chmoda+xexer1chmodg+wexer1或者chmod775exer18、字符串“touppercase”分别用php,shell,js实现将字符串中的字符全部转换成大写并输出。(5分)Php实现:echostrtoupper(‘touppercase’)Shell实现:echo"touppercase"|tr'a-z''A-Z'Js实现:<scriptlanguage="javascript">varstmp1="touppercase";alert(());//转换成大写alert(())//转换成大写</scr