zoukankan      html  css  js  c++  java
  • 2020-PHP面试

    请问公司技术团队有多少人,php开发的有多少?
    
    我到公司负责做什么,
    
    待遇如何

    -------------
    高并发:

    使用缓存,
    建立索引
    分表
    优化sql
    1.谈谈你对mvc的认识

    考点:M() C(服务员) V(菜单)
    mvc工作原理 Model+view+Controller
    (数据模型层:对数据进行加工,对数据进行的操作,)
    (业务处理处理)
    (页面展示的)

    -------------
    Tp,Laravel

    单一入口方便进行安全性检测

    MyISAM innodb  区别

    myisam 不支持事务,innodb支持事务
    表级锁 行级锁
    支持全文索引 不支持全文索引

    git 常用指令

    git add .
    git commit -m'test'
    git push orign master

    git reset --hard 22222

    git log
    打印出昨天的日期:   days   week    month

    echo date('Y-m-d H:i:s',strtotime('-1 month',time()));
    php 遍历指定目录下所有的文件:
    function openPathDir($path) { $fileArray = []; // 判断是否未目录 $isDir = is_dir($path); // var_dump($isDir); if ($isDir) { // 是目录 $pathFileOpen = opendir($path); if ($pathFileOpen) { // //返回当前文件的条目 while (($file = readdir($pathFileOpen)) !== false) { //去除特殊目录 if ($file != "." && $file != "..") { //判断子目录是否还存在子目录 if (is_dir($path . "/" . $file)) { //递归调用本函数,再次获取目录 $newFile = $path.'/'.$file; $fileArray[$file] = openPathDir($newFile); } else { //获取目录数组 $fileArray[] = $dir . "/" . $file; } } } // print_r($fileArray);exit; //关闭文件夹 closedir($pathFileOpen); //返回文件夹数组 return $fileArray; } } } $path = "D:phpstudy_pro_newWWWsaas.com"; $a = openPathDir($path); print_r($a);exit; ?>
    下划线-首字母大写:
    <?php
        $a = 'test_id';
    
        $c = str_replace('_',' ',$a);
    
        $b= ucwords($c);
        $c = str_replace(' ','',$b);
    ?>
    Memcached与Redis有什么区别

    Redis支持的数据类型要丰富得多。
    由于Redis只使用单核,而Memcached可以使用多核,所以平均每一个核上Redis在存储小数据时比Memcached性能更高。
    而在100k以上的数据中,Memcached性能要高于Redis,虽然Redis也在存储大数据的性能上进行了优化,但是比起Memcached,还是稍有逊色。

    数据库最左前最原则:
    在使用多列索引或建立多列索引时,我们一般要遵循“最左前缀原则”。请简单说明“最左前缀原则”。 针对单列索引, 左边准确而右边模糊,可以用到索引,反之则不可以. 如
    where name like ‘poly%’,可以用到, 而”%poly”则不用到. 针对多列索引, 左边的列用到索引后,右侧的列才有可能用到索引. 例 index(a,b,c), where a=? and b=? ,b列索引会用到. 如果直接 where b=?, 因为a列没用索引,所以b索引,用不到.
    正则表达式,ip
    
    <?php
    $a = '127.0.0.111';
    $b = preg_match("/^d{1,3}.d{1,3}.d{1,3}.d{1,3}$/",$a);
    var_dump($b);
    __construct(),__destruct(),__clone(),__autoload(),__tostring(),__invoke(),__set(),__get(),__unset(),__isset(),__call(),__callstatic;
    // 冒泡排序
    function bubble_sort($arr)
    {
        $len = count($arr);
        for ($i = 0; $i < $len -1; $i++) {//循环对比的轮数
            for ($j = 0; $j < $len - $i - 1; $j++) {//当前轮相邻元素循环对比
                if ($arr[$j] > $arr[$j + 1]) {//如果前边的大于后边的
                    $tmp = $arr[$j];//交换数据
                    $arr[$j] = $arr[$j + 1];
                    $arr[$j + 1] = $tmp;
                }
            }
        }
        return $arr;
    }
    $arr = [5,2,4,7,9,4,2,6,8,3];
    print_r(bubble_sort($arr));

    <?php
    function openPathDir($path){$fileArray = [];//判断是否未目录$isDir = is_dir($path);// var_dump($isDir);if ($isDir) {//是目录$pathFileOpen = opendir($path);if ($pathFileOpen) {////返回当前文件的条目            while (($file = readdir($pathFileOpen)) !== false) {                //去除特殊目录                if ($file != "." && $file != "..") {                    //判断子目录是否还存在子目录                    if (is_dir($path . "/" . $file)) {                        //递归调用本函数,再次获取目录                        $newFile = $path.'/'.$file;                        $fileArray[$file] = openPathDir($newFile);                    } else {                        //获取目录数组                        $fileArray[] = $dir . "/" . $file;                    }                }            }            // print_r($fileArray);exit;            //关闭文件夹            closedir($pathFileOpen);            //返回文件夹数组            return $fileArray;}} 
    echo 'demo';}$path = "D:phpstudy_pro_newWWWsaas.com";$a = openPathDir($path);print_r($a);exit;?>

  • 相关阅读:
    jQuery事件
    jQuery选择器
    jQuery对象和语法
    jQuery简介
    残差的正态性检验——概率图和QQ-plot图
    https://oldpan.me/深度学习博客
    深度学习的内存消耗在哪里?
    图片缩放
    随机梯度下降批尺寸的影响
    利用PIL.ImageOps.invert实现二值图像黑白反转
  • 原文地址:https://www.cnblogs.com/vip-deng-vip/p/12716526.html
Copyright © 2011-2022 走看看