设为首页 收藏本站
查看: 967|回复: 0

[经验分享] 收錄PHP試題

[复制链接]
累计签到:8 天
连续签到:1 天
发表于 2015-8-24 13:55:41 | 显示全部楼层 |阅读模式
  1、用PHP打印出前一天的时间格式是2006-5-10 22:21:21
         date_default_timezone_set('PRC');                //设置中国时区
  echo $today=date("Y-m-d h:i:s",(time()-86400)); //昨天時間
  
  
  2、echo(),print(),print_r()的区别
  echo是PHP语句, print和print_r是函数,语句没有返回值,函数可以有返回值(即便没有用)
print只能打印出简单类型变量的值(如int,string)
print_r可以打印出复杂类型变量的值(如数组,对象)
  
  3.在 PHP 和 C 语言 中,有两种类型的递增前递增和后递增,本质上来讲,前递增和后递增均增加了变量的值,并且对于变量的影响是相同的。不同的是递增表达式的值。前递增,写做“++$variable”,求增加后的值(PHP 在读取变量的值之前,增加变量的值,因而称之为“前递增”)。后递增,写做“$variable++”,求变量未递增之前的原始值(PHP 在读取变量的值之后,增加变量的值,因而叫做“后递增”)。
  $a = 1;
  $b = $a++;
  $b的值爲1
  
  3.使用哪些工具进行版本控制?
  SNV(Subversion)、VSS(源代码管理器)等
  
  4.如何实现字符串翻转?
  $luokuan = "ABCDEFG-测试的啊-!!!一二三四五。。";
  $n = mb_strlen("$luokuan");
  //echo $n;
  $newluokuan = "";
  for ($i=$n;$i>=0;$i--)
  {
  //$newluokuan.= substr($luokuan,$i,1);
  $newluokuan.= mb_substr($luokuan,$i,1,'utf-8');
  
  }
  echo $newluokuan;
  
  不考虑中英文混合,不是最优算法,不用php库函数翻转字符串:
  
  
  
  
  
  5. 优化MYSQL数据库的方法
  1、选取最适用的字段属性
  2、使用连接(JOIN)来代替子查询(Sub-Queries)
  3、使用联合(UNION)来代替手动创建的临时表
  4、事务
  5、锁定表
  6、使用外键
  7、使用索引
  
  6、能够使HTML和PHP分离开使用的模板
  smarty,phplib,SmartTemplate…
  
  7、谈谈事务处理
  可以控制并发事务所产生的数据同步提交,更新问题,就是一个锁的概念.comit,rollback
  
  8、apache+mysql+php实现最大负载的方法
  问的太笼统,生成静态html页面,squid反向代理,apache,mysql的负载均衡.
  
  9、实现中文字串截取无乱码的方法。
  这个首先要考虑字符集的问题,UTF-8下一个汉字占3字节,GBK下一个汉字占2字节.可以自己写个函数来处理,别人也写了很多,当然也可以开启mbstring扩展库,使用里面的mb_substr()等函数来截取
  
  10.
  var $empty       = '';
  var $null        = NULL;
  var $bool        = FALSE;
  var $notSet;
  var $array       = array();
  
  
  $a = "hello";
  $b = &$a;
  unset($b);
  $b = "world";
  what is $a?
  hello,unset($b)只是释放了$b自己和$a的别名关系,并不会释放$a
  
  
  $a = 1;
  $x = &$a;
  $b = $a++;
  what is $b?
  1,先执行$b = $a,$a++再进行,所以$b还是1
  
  $x = empty($array);
  what is $x?   true    or    false
  true,$array是空数组
  
  
  12.您是否用过版本控制软件? 如果有您用的版本控制软件的名字是?
  CVS:winCVS,是一个CVS的客户端
  VSS,微软的产品,比较适合中小型项目,只支持单人checkout
  
  13.您是否用过模板引擎? 如果有您用的模板引擎的名字是?
  SMARTY,php官方推荐的模板引擎,它是编译型模板,与phplib不太相同,功能强大,30多种标签,支持cache
  
  14.对于大流量的网站,您采用什么样的方法来解决访问量问题?
  squid[反向代理],最好的选择!当然,money不是问题的话,增加带宽也是很好的选择!
  
  15.用PHP写出显示客户端IP与服务器IP的代码:
  echo $_SERVER['REMOTE_ADDR'] //客户端ip
  echo $_SERVER['SERVER_ADDR'] //服务器端ip
  
  
  面试题3
  一、PHP/MySQL编程
  
  1)       某内容管理系统中,表message有如下字段
id 文章id
title 文章标题
content 文章内容
category_id 文章分类id
hits 点击量

创建上表,写出MySQL语句
  create table message
  (
         id INT    NOT NULL AUTO_INCREMENT PRIMARY KEY,
         title varchar(100),
         content varchar(225),
         category_id int,
         hits int     
  )
  
  mssql語句:
create table message

(

    id INT  identity(1,1) not null primary key,

    title varchar(100),

    [content] varchar(225),

[category_id] int,

    hits int

  )
  
  
  
  2)同样上述内容管理系统:表comment记录用户回复内容,字段如下
  comment_id 回复id
  id 文章id,关联message表中的id
  comment_content 回复内容
  现通过查询数据库需要得到以下格式的文章标题列表,并按照回复数量排序,回复最高的排在最前面
  文章id 文章标题 点击量 回复数量
  用一个SQL语句完成上述查询,如果文章没有回复则回复数量显示为0
  
  select a.id,  a.title,  a.hits, if(ifnull(b.id,false),count(*),0) as replay from message a left join comment b on a.id=b.id
  group by a.id
  order by replay desc
  
  
  3)上述内容管理系统,表category保存分类信息,字段如下 (3分)
  category_id int(4) not null auto_increment;
  categroy_name varchar(40) not null;
  用户输入文章时,通过选择下拉菜单选定文章分类
  写出如何实现这个下拉菜单
  
  function categoryList()
  {
      $result=mysql_query("select category_id,categroy_name from category")
              or die("Invalid query: " . mysql_error());
      print("<select name='category' value=''>"n");
      while($rowArray=mysql_fetch_array($result))
      {
         print("<option value='".$rowArray['category_id']."'>".$rowArray['categroy_name']."</option>"n");
      }
      print("</select>");
  }
  
  
  三、PHP程序
  
  1) 写出以下程序的输出结果
  <?
  
  $b=201;
  
  $c=40;
  
  $a=$b>$c?4:5;
  
  echo $a;
  
  ?>
  
  $a=4
  
  
  2) 写出以下程序的输出结果
  
  <?
  
  $str="cd";
  
  $$str="hotdog";
  
  $$str.="ok";
  
  echo $str;
  
  ?>
  
  $str="cd";
  
  四、
  1.请说明 PHP 中传值与传引用的区别。什么时候传值什么时候传引用?
  传值只是把某一个变量的值传给了另一个变量,而引用则说明两者指向了同一个地方。
  
  2   在PHP中error_reporting这个函数有什么作用?
       设定php脚本的错误报告级别。
  
  3         请用正则表达式(Regular Expression)写一个函数验证电子邮件的格式是否正确。
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gif/*
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gif检查邮件地址是否为邮件地址,返回逻辑值
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gif*/
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.giffunction CheckMailAdr($str){
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gifreturn(eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}$",$str));
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gif}
  
  http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gif4   简述如何得到当前执行脚本路径,包括所得到参数。
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gif说明:例如有一个脚本 www.domain.com,传给他的参数有参数1,参数2,参数3&#8230;。传递参数的方法有可能是GET有可能是POST,那么现在请写出类似:http://www.domain.com/script.php?参数1=值1&参数2=值2.....   的结果
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gif     关于前执行脚本路径感觉有点歧义:若是得到该脚本在服务器上的绝对路径用 $_SERVER[&#8216;APPL_PHYSICAL_PATH&#8217;].若是该脚本的URL则可以用获取
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gif     获取所有参数:可以用以下方法:
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gif//获取post的数据
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gifwhile (list($var, $value) = each($HTTP_POST_VARS))
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gif{
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gif    echo "$var = $value n";
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gif}
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gif//获取get方式的数据
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gifwhile (list($var, $value) = each($HTTP_GET_VARS))
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gif{
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gif    echo "$var = $value n";
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gif}
  
  
5   有一个一维数组,里面存储整形数据,请写一个函数,将他们按从大到小的顺序排列。要求执行效率高。并说明如何改善执行效率。
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gif(该函数必须自己实现,不能使用php函数)
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gif可以用冒泡排序

http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gif<?php
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.giffunction BubbleSort($str)
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gif{
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.giffor ($i=0;$i<count($str);$i++)
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gif{     
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gif    for ($j=count($str)-2;$j>=$i;$j--)
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gif     {
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gif            if($str[$j+1]<$str[$j])
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gif             {   
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gif                $tmp = $str[$j+1];
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gif                 
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gif                $str[$j+1]=$str[$j];
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gif                $str[$j]=$tmp;
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gif             }
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gif
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gif     }
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gif
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gif}
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gifreturn $str;
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gif}
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gif$str = array(3,6,1,5,9,0,4,6,11);
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gifprint_r(BubbleSort($str));
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gif?>

  
  
  http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gif6   请举例说明在你的开发过程中用什么方法来加快页面的加载速度
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gifA.生成静态HTML,
  http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gifB.生成XML
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ZHEN%7E1.WAN/LOCALS%7E1/Temp/msohtml1/03/clip_image001.gifC.用ZEND加速
  
  
  面试题8
1-如何通过javascript判断一个窗口是否已经被屏蔽。
  <script>   
   var   result   =   window.open("/somepage.aspx");   
   if(result==null)   
   {   
          alert("浏览器不允许弹出窗口");   
   }   
   </script>
  
  
2-写出session的运行机制
  用户A访问站点Y,如果站点Y执行了session_start();(以下假定session_start()总是存在)那么会产生一个 session_id,这个session id一般会以COOKIE的形式保存到用户A(我们可以通过在php.ini里设置session.use_only_cookies为1,强制 SESSION ID必须以COOKIE传递。)。这时候SESSION ID表现为$_COOKIE[&#8217;PHPSESSID&#8217;];(PHPSESSID可用session_name()函数来修改)
  用户A接着访问,这个session id($_COOKIE[&#8217;PHPSESSID&#8217;])就会在A每次访问Y的时候传送到站点Y。
  在站点Y上,会有这么一个目录,是用来保存SESSION的实际数据的。站点Y接收到session id,然后通过session id,来获得与SESSION数据的关联,并返回SESSION数据。
  
  

3-防止SQL注射漏洞一般用_____函数。
         addslashes
  
  


  4- 写出发贴数最多的十个人名字的SQL,利用下表:
   members(id,username,posts,pass,email)
SELECT username,count(*) as num FROM `members` group by username order by count(*) desc limit 10
  
  5
  给你三个数,写程序求出其最大值。
$var1=1;
$var2=7;
$var3=8;
$max=$var1>$var2?$var1:$var2;
$max=$max>$var3?$max:$var3;
echo $max;
  
  6)有一表 menu(mainmenu,submenu,url),请用递归法写出一树形菜单,将所有的menu列出来
   <html>
  <head><title>JS打印</title></head>
  <body>
  <form>
  <?php
  function GenerateMenu($id=0,$str="")
  {
       $result=mysql_query("select mainmenu,url,submenu from menu where mainmenu=$id");
       while($row=mysql_fetch_array($result))
       {
           echo $str.$row["url"]."<br />";
           GenerateMenu($row["submenu"],$str."--");
       }
       mysql_free_result($result);
  }
  
  $link=mysql_connect("localhost","root","");
  mysql_select_db("phpinterview");
  GenerateMenu();
  mysql_close($link)
  ?>
  </form>
  </body>
  </html>
  
  
  7.执行程序段<?php echo 8%(-3) ?>
  将输出 2
  
  
  8.HTTP 1.0中,状态码 401 的含义是
  401 (Unauthorized/未授权)
  401 (SC_UNAUTHORIZED)表示客户端在授权头信息中没有有效的身份信息时访问受到密码保护的页面。这个响应必须包含一个WWW-Authenticate的授权信息头
  
  9.数组函数 arsort 的作用是();语句 error_reporting(2047)的作用是()。
  arsort --  对数组进行逆向排序并保持索引关系
  error_reporting(2047)  所有的錯誤警告
  All errors and warnings, as supported, except of level E_STRICT.
  
  10、请写出PHP5权限控制修饰符(3分)
  private protected public
  
  
  11、请写出php5的构造函数和析构函数(2分)
  __construct __destruct
  
  12、取得查询结果集总数的函数是?(1分)
  mysql_num_rows($res);
  
  13.在PHP中,当前脚本的名称(不包括路径和查询字符串)记录在预定义变量(1)中;而链接到当前页面的URL记录在预定义变量(2)中。
  echo $_SERVER['PHP_SELF']; echo $_SERVER["HTTP_REFERER"];
  
  14. 在HTTP 1.0中,状态码 401 的含义是(4);如果返回&#8220;找不到文件&#8221;的提示,则可用 header 函数,其语句为(5)。
  (4)未授权 (5) header("HTTP/1.0 404 Not Found");
  
  15 写出一个正则表达式,过虑网页上的所有JS/VBS脚本(即把script标记及其内容都去掉):(9)。
  Echo preg_replace("/<script[^>].*?>.*?<"/script>/si","","dfedf<script lang='dfdf'>fddddddddddd</script>dffffff");
  
  16..以Apache模块的方式安装PHP,在文件http.conf中首先要用语句(10)动态装载PHP模块,然后再用语句(11)使得Apache把所有扩展名为php的文件都作为PHP脚本处理。
  (10)LoadModule    php5_module "D:/xampp/apache/bin/php5apache2.dll"
  (11) AddType application/x-httpd-php-source .phps
    AddType application/x-httpd-php .php .php5 .php4 .php3 .phtml
  
  17.语句 include 和 require 都能把另外一个文件包含到当前文件中,它们的区别是(12);为了避免多次包含同一文件,可以用语句(13)来代替它们。
  (12) 发生异常时include产生警告require产生致命错误 (13)require_once()/include_once()
  
  18.类的属性可以序列化后保存到 session 中,从而以后可以恢复整个类,这要用到的函数是(14)。
  serialize() /unserialize()
  
  19.一个函数的参数不能是对变量的引用,除非在php.ini中把(15)设为on.
  allow_call_time_pass_reference
  
  20.SQL 中LEFT JOIN的含义是(16)。
  (16) 自然左外连接
  
  21.如果 tbl_user记录了学生的姓名(name)和学号(ID)
  tbl_score记录了学生(有的学生考试以后被开除了,没有其记录)的学号(ID)和考试成绩(score)以及考试科目(subject)
  要想打印出各个学生姓名及对应的的各科总成绩,则可以用SQL语句(17)。
  
  (17) select name , count(score) as sum_score from tbl_user left join tbl_score on tbl_user.ID=tbl_score.ID group by tbl_user.ID
  
  22.在PHP中,heredoc是一种特殊的字符串,它的结束标志必须(18)。
  结束标识符所在的行不能包含任何其它字符除";"
  
  23.一个函数,能够遍历一个文件夹下的所有文件和子文件夹
  
  /**
   * 遍历目录,结果存入数组。支持php4及以上。php5以后可用scandir()函数代替while循环。
   * @param string $dir
   * @return array
   */
  function my_scandir($dir)
  {
     $files = array();
     if ( $handle = opendir($dir) ) {
         while ( ($file = readdir($handle)) !== false ) {
             if ( $file != ".." && $file != "." ) {
                 if ( is_dir($dir . "/" . $file) ) {
                     $files[$file] = my_scandir($dir . "/" . $file);
                 }else {
                     $files[] = $file;
                 }
             }
         }
         closedir($handle);
         return $files;
     }
  }

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-103549-1-1.html 上篇帖子: FastJSON(PHP版本)在decode时的bug及修正方法 下篇帖子: 【翻译自nikic大神】PHP中原生类型的方法
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表