• php面试题6


    php面试题6

    一、总结

    二、php面试题6

    写出你认为语言中的高级函数:
    1)preg_replace()
    2)preg_match()
    3) ignore_user_abort()
    4) debug_backtrace()
    5) date_default_timezone_set(“PRC”)
    6) get_class_methods() 得到类的方法名的数组
    7) preg_split() 字符串分割成数组
    8)json_encode() //js for in 关联数组和对象
    9)parse_url()
    10)parse_str()
    11)pathinfo()
    12)array_multisort()

    简述 Cookie 的设置及获取过程:
    1)设置
    <?php
    $value = 'something from somewhere';
    setcookie("TestCookie", $value);

    setcookie("TestCookie", $value, time()+3600); /* expire in 1 hour */?>
    2) <?php
    // set the expiration date to one hour ago
    setcookie ("TestCookie", "", time() - 3600);?>
    3)获取方法:
    print_r($_COOKIE);

    面向对象中接口和抽象类的区别及应用场景:
    他们的不同点:
    1。抽象类中可以有非抽象的方法而接口中只能够有抽象的方法!
    2。一个类可以继承多个接口,而一个类只能继承一个抽象类!
    3。接口的使用方式通过 implements 关键字进行,抽象类则是通过继承 extends 关键字
    进行!
    interface one{
    function fun1();
    function fun2();
    }
    abstract class two implements one{
    abstract function fun1();
    abstract function fun2();

    }
    class four extents two{
    function fun1(){
    echo "fun1";
    }
    function fun2(){
    echo "fun2";
    }
    }

    4、用面向对象来实现 A 对象继承 B 和 C 对象:
    <?php
    class C {
    function funC(){
    echo "funC";
    }
    }
    class B extends C {
    function funB(){
    echo "funB";
    }

    }
    class A extends B {
    function funA(){
    echo "funA";
    }
    }
    $p=new A();
    $p->funC();
    $p->funB();
    $p->funA();
    ?>

    写出 Smarty 模板引擎中你最常用的关键词:
    1)assign
    2)display
    3) caching
    4) left_delimiter
    5) right_delimiter
    6) function nocache($param, $content, &$smarty) {
          return $content;
    }

    $smarty->register_block('nocache', 'nocache', false);
    7)foreach
    8)include

    MySQL存储引擎中MyISAM和InnoDB,在同样的应用场景中各有什么优缺点,索引结构如何实现:
    1)在增、删、改和查方面,myisam要优于innodb表引擎,当数据量特别大时,他们的速度相差不大
    2)innodb支持myisam所不具备的事务支持、存储过程、行级锁定等等

    7、如下user表结构
    

    如果是一个 Web 频繁访问的查询,上题的查询如何优化?
    1)create index in_age on user(age);
    2)desc select uid,name,age from user where age>20 && age<30;
    3)alter table user add index in_age(age);



    8、Web 开发的遇到的困难有哪些?
    1)表的设计
    2)sql 语句的书写和优化
    3)ajax 的使用
    4)前后台数据交互
    

     写出你认为语言中的高级函数:
    1.数组
    array_filter();
    array_map();
    array_multisort();
    array_count_values();
    array_splice();

    2.字符串
    htmlspecialchars();
    htmlspecialchars_decode();
    json_encode();
    json_decode();
    substr_count();
    pathinfo();
    parse_url();
    parse_str();

    3.正则
    preg_match_all();
    preg_replace();

    5.文件
    file_get_contents();
    file_put_contents();
    scandir();
    readfile();

    6.画图
    imagecreatefromjpeg();

    7.cookie与session
    setcookie();
    session_id();
    session_name();

    8.数据库操作
    mysql_fetch_assoc();
    last_insert_id();

    smarty模板引擎中的关键字:
    1.assign();
    2.display();
    3.for
    4.if
    5.foreach
    6.volist

  • 相关阅读:
    T4模板+Web.config连接SqlServer+DBManage.cs+DbHelper.cs
    MVCApplication
    MVC路由(Route)
    过滤器+用session验证是否登陆过
    前台.cshtml得到session值方法
    C++ sort() method with 1.default operator,2 stand library compare ,3custom function,4,lambda expression
    C++ boost serialize struct to text
    C++ multi thread via pthread to retrieve returned result
    C++ pthread create and join
    C++ write and read file via fstream in ios::out,ios::in,ios::app mode
  • 原文地址:https://www.cnblogs.com/Renyi-Fan/p/9063208.html
Copyright © 2020-2023  润新知