久久综合丝袜日本网手机版,日韩欧美中文字幕在线三区,亚洲精品国产品国语在线,极品在线观看视频婷婷

      • 騰訊PHP筆試?

        時間:2022-07-10 21:58:47 筆試 我要投稿
        • 相關(guān)推薦

        騰訊PHP筆試?

        騰訊PHP筆試?

        1. 請對POSIX風(fēng)格和兼容Perl風(fēng)格兩種正則表達(dá)式的主要函數(shù)進(jìn)行類比說明

        ereg preg_match

        ereg_replace preg_replace

        2. 請說明在php.ini中safe_mode開啟之后對于PHP系統(tǒng)函數(shù)的影響

        3. PHP5中魔術(shù)方法函數(shù)有哪幾個,請舉例說明各自的用法

        __sleep

        __wakeup

        __toString

        __set_state

        __construct,

        __destruct

        __call,

        __get,

        __set,

        __isset,

        __unset

        __sleep,

        __wakeup,

        __toString,

        __set_state,

        __clone

        __autoload

        4. 請寫出讓,并說明如何在命令行下運行PHP腳本(寫出兩種方式)同時向PHP腳本傳遞參數(shù)?

        5. PHP的垃圾收集機制是怎樣的

        6.使對象可以像數(shù)組一樣進(jìn)行foreach循環(huán),要求屬性必須是私有。

        (Iterator模式的PHP5實現(xiàn),寫一類實現(xiàn)Iterator接口)

        7.請寫一段PHP代碼,確保多個進(jìn)程同時寫入同一個文件成功

        8. 用PHP實現(xiàn)一個雙向隊列

        9. 使用正則表達(dá)式提取一段標(biāo)識語言(html或xml)代碼段中指定標(biāo)簽的指定屬性值(需考慮屬性值對不規(guī)則的情況,如大小寫不敏感,屬性名值與等號間有空格等)。此處假設(shè)需提取test標(biāo)簽的attr屬性值,請自行構(gòu)建包含該標(biāo)簽的串

        10.請使用socket相關(guān)函數(shù)(非curl)實現(xiàn)如下功能:構(gòu)造一個post請求,發(fā)送到指定http server的指定端口的指定請求路徑請求中包含以下變量:

        用戶名(username):溫柔一刀

        密碼(pwd):&123=321&321=123&

        個人簡介(intro):Hello world!

        且該http server需要以下cookie來進(jìn)行簡單的用戶動作跟蹤:

        cur_query:you&me

        last_tm:...(上次請求的unix時間戳,定為當(dāng)前請求時間前10分鐘)

        cur_tm:...(當(dāng)前請求的unix時間戳)

        設(shè)置超時為10秒,發(fā)出請求后,將http server的響應(yīng)內(nèi)容輸出。復(fù)制內(nèi)容到剪貼板代碼:Function encode($data, $sep = ‘&’){

        while (list($k,$v) = each($data)) {

        $encoded .= ($encoded ? "$sep" : "");

        $encoded .= rawurlencode($k)."=".rawurlencode($v);

        }

        Return $encoded;

        }

        Function post($url, $post, $cookie){

        $url = parse_url($url);

        $post = encode($data, ‘&’);

        $cookie = encode($cookieArray, ‘;’);

        $fp = fsockopen($url[host], $url[port] ? $url[port] : 80, $errno, $errstr, 10);

        if (!$fp) return "Failed to open socket to $url[host]";

        fputs($fp, sprintf("POST %s%s%s HTTP/1.0 ", $url[path], $url[query] ? "?" : "", $url[query]));

        fputs($fp, "Host: $url[host] ");

        fputs($fp, "Content-type: application/x-www-form-urlencoded ");

        fputs($fp, "Content-length: " . strlen($encoded) . " ");

        fputs($fp, "Cookie: $cookie ");

        fputs($fp, "Connection: close ");

        fputs($fp, "$post ");

        while (!feof($fp)) {

        echo fgets($fp, 128);

        }

        fclose($fp);

        }

        $url = ‘http://www.example.com:8080/test’;

        $encoded = username=溫柔一刀& pwd=

        $post = array(

        ‘username’=> ‘溫柔一刀’,

        ‘pwd => ‘&123=321&321=123&’,

        ‘intro => ‘Hello world!’

        );

        $cookie = array(

        ‘cur_query’ => ‘you&me,

        ‘last_tm’ => time() - 600,

        ‘cur_tm ‘=> time()

        );

        Post($url, $post, $cookie);

        11.你用什么方法檢查PHP腳本的執(zhí)行效率(通常是腳本執(zhí)行時間)和數(shù)據(jù)庫SQL的效率(通常是數(shù)據(jù)庫Query時間),并定位和分析腳本執(zhí)行和數(shù)據(jù)庫查詢的瓶頸所在?

        1.腳本執(zhí)行時間,啟用xdebug,使用WinCacheGrind分析。

        2.數(shù)據(jù)庫查詢,mysql使用EXPLAIN分析查詢,啟用slow query log記錄慢查詢。

        PHP LAMP Engineer Test Paper

        Question 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("%.2d ", 42);

        B) printf("%1.2f ", 42);

        C) printf("%1.2u ", 42);

        Question 3

        Given

        $text = Content-Type: text/xml;

        Which of the following prints text/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 = in_array(01, array(1)) == var_dump(01 == 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 definitions 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.

        Question 7

        When turned on, ____________ will _________ your script with different variables from HTML forms and cookies.

        A) show_errors, enable

        B) show_errors, show

        C) register_globals, enhance

        D) register_globals, inject

        Question 8

        What will be the output of the following PHP code:

        echo count(strlen("http://php.net"));

        ?>

        Answer: 1

        Question 9

        What is the best all-purpose way of comparing 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

        【騰訊PHP筆試?】相關(guān)文章:

        騰訊cdkey領(lǐng)取方法01-07

        有關(guān)農(nóng)業(yè)銀行筆試真題筆試07-03

        移動筆試07-22

        求職筆試題12-23

        騰訊微云怎么搜索資源?04-22

        騰訊游戲運營待遇如何08-04

        php個人求職簡歷08-15

        騰訊公益圖標(biāo)怎么永久點亮08-04

        怎么點亮騰訊QQ旋風(fēng)圖標(biāo)08-01

        騰訊CDC是否真的解散了?06-27