收藏 分销(赏)

公司面试题之-腾讯PHP工程师笔试题.doc

上传人:二*** 文档编号:4484186 上传时间:2024-09-24 格式:DOC 页数:8 大小:22.54KB
下载 相关 举报
公司面试题之-腾讯PHP工程师笔试题.doc_第1页
第1页 / 共8页
亲,该文档总共8页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

1、公司面试题之 腾讯PHP工程师笔试题 1 请对pOSIX风格和兼容perl风格两种正那么表达式的主要函数进行类比说明 ereg pregmatch eregreplace pregreplace 2 请说明在php.ini中safemode开启之后对于pHp系统函数的影响 3 pHp5中魔术方法函数有哪几个,请举例说明各自的用法 sleep wakeup toString setstate construct, destruct call, get, set, isset, unset sleep, wakeup, toString, setstate, clone autoload 4 请写

2、出让,并说明如何在命令行下运行pHp脚本(写出两种方式)同时向pHp脚本传递参数? 5 pHp的垃圾收集机制是怎样的 6使对象可以像数组一样进行foreach循环,要求属性必须是私有。 (Iterator模式的pHp5实现,写一类实现Iterator接口) 7请写一段pHp代码,确保多个进程同时写入同一个文件成功 8 用pHp实现一个双向队列 9 使用正那么表达式提取一段标识语言(html或xml)代码段中指定标签的指定属性值(需考虑属性值对不规那么的情况,如大小写不敏感,属性名值与等号间有 空格等)。此处假设需提取test标签的attr属性值,请自行构建包含该标签的串 10请使用socket

3、相关函数(非curl)实现如下功能:构造一个post请求,发送到指定 server的指定端口的指定请求路径。请求中包含以下变量: 用户名(username):温柔一刀 密码(pwd):&123=321&321=123& 个人简介(intro):Hello world! 且该 server需要以下cookie来进行简单的用户动作跟踪: curquery:you&me lasttm:.(上次请求的unix时间戳,定为当前请求时间前10分钟) curtm:.(当前请求的unix时间戳) 设置超时为10秒,发出请求后,将 server的响应内容输出。复制内容到剪贴板代码:Function encode

4、($data, $sep = &) while (list($k,$v) = each($data) $encoded .= ($encoded ? $sep : ); $encoded .= rawurlencode($k).=.rawurlencode($v); Return $encoded; Function post($url, $post, $cookie) $url = parseurl($url); $post = encode($data, &); $cookie = encode($cookieArray, ;); $fp = fsockopen($urlhost, $ur

5、lport ? $urlport : 80, $errno, $errstr, 10); if (!$fp) return Failed to open socket to $urlhost; fputs($fp, sprintf(pOST %s%s%s HTTp/1.0n, $urlpath, $urlquery ? ? : , $urlquery); fputs($fp, Host: $urlhostn); fputs($fp, Content-type: application/x-form-urlencodedn); fputs($fp, Content-length: . strle

6、n($encoded) . n); fputs($fp, Cookie: $cookienn); fputs($fp, Connection: closenn); fputs($fp, $post n); while (!feof($fp) echo fgets($fp, 128); fclose($fp); $url = s:/.example.:8080/test; $encoded = username=温柔一刀& pwd= $post = array( username= 温柔一刀, pwd = &123=321&321=123&, intro = Hello world! ); $c

7、ookie = array( curquery = you&me, lasttm = time() - 600, curtm = time() ); post($url, $post, $cookie); 11你用什么方法检查pHp脚本的执行效率(通常是脚本执行时间)和数据库SQL的效率(通常是数据库Query时间),并定位和分析脚本执行和数据库查询的瓶颈所在? 1脚本执行时间,启用xdebug,使用WinCacheGrind分析。 2数据库查询,mysql使用EXpLAIN分析查询,启用slow query log记录慢查询。 pHp LAMp Engineer Test paper Que

8、stion 1 What does print out? A) 3 B) False C) Null D) 1 E) 0 Question 2 Which of the following snippets prints a representation of 42 with two decimal places? A) printf(%.2dn, 42); B) printf(%1.2fn, 42); C) printf(%1.2un, 42); Question 3 Given $text = Content-Type: text/xml; Which of the following p

9、rints ext/xml? A) print substr($text, strchr($text, :); B) print substr($text, strchr($text, :) + 1); C) print substr($text, strpos($text, :) + 1); D) print substr($text, strpos($text, :) + 2); E) print substr($text, 0, strchr($text, :) Question 4 What is the value of $a? $a = inarray(1, array(1) =

10、vardump(1 = 1); ? A) True B) False Question 5 What is the value of $result in the following pHp code? function timesTwo($int) $int = $int * 2; $int = 2; $result = timesTwo($int); ?; Answer: NULL Question 6 The code below because . class Foo ? function bar() print bar; ? A) will work, class definitio

11、ns can be split up into multiple pHp blocks. B) will not work, class definitions must be in a single pHp block. C) will not work, class definitions must be in a single file but can be in multiple pHp blocks. D) will work, class definitions can be split up into multiple files and multiple pHp blocks.

12、 Question 7 When turned on, will your script with different variables from HTML forms and cookies. A) showerrors, enable B) showerrors, show C) registerglobals, enhance D) registerglobals, inject Question 8 What will be the output of the following pHp code: echo count(strlen(s:/php.); ? Answer: 1 Question 9 What is the best all-purpose way of paring two strings? A) Using the strpos function B) Using the = operator C) Using strcasecmp() D) Using strcmp() Question 10 What is the difference between print() and echo()? Answer: print is a function,echo is a language construct

展开阅读全文
部分上传会员的收益排行 01、路***(¥15400+),02、曲****(¥15300+),
03、wei****016(¥13200+),04、大***流(¥12600+),
05、Fis****915(¥4200+),06、h****i(¥4100+),
07、Q**(¥3400+),08、自******点(¥2400+),
09、h*****x(¥1400+),10、c****e(¥1100+),
11、be*****ha(¥800+),12、13********8(¥800+)。
相似文档                                   自信AI助手自信AI助手
搜索标签

当前位置:首页 > 教育专区 > 初中其他

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        获赠5币

©2010-2025 宁波自信网络信息技术有限公司  版权所有

客服电话:4008-655-100  投诉/维权电话:4009-655-100

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :gzh.png    weibo.png    LOFTER.png 

客服