编程题
来源:互联网 发布:生意参谋怎么看数据 编辑:程序博客网 时间:2024/06/05 19:51
1. 写一个函数,能够遍历一个文件夹下的所有文件和子文件夹。function my_scandir($dir){ $files = array(); if($handle = opendir($dir)) { while(($files = readdir($handle)) !== flase) { if($files != '..' && $files != '.') { if(is_dir($dir . '/' . $files)) { $files[$files] = scandir($dir . '/' . $files); } else { $files[] = $files; } } } closedir($files); return $files; } }2. php 字符串截取函数,支持中英文混合截取/*------------------------------------------------------参数:$str_cut 需要截断的字符串$length 允许字符串显示的最大长度程序功能:截取全角和半角(汉字和英文)混合的字符串以避免乱码------------------------------------------------------*/function substr_cut($str_cut,$length){ if (strlen($str_cut) > $length) { for($i=0; $i < $length; $i++) if (ord($str_cut[$i]) > 128) $i++; $str_cut = substr($str_cut,0,$i).".."; } return $str_cut;}
阅读全文
0 0
- 编程题
- 编程题
- 编程题?
- 编程题
- 编程题
- 编程题
- 编程题
- 编程题
- 编程题
- 编程题
- 编程题
- 编程题
- 编程题
- 编程题
- 编程题
- 编程题
- 编程题
- 编程题
- Kafka+Storm+HBase项目Demo(3)--Storm安装配置
- Spring核心AOP(面向切面编程)总结
- vb.net 教程 4-7 文本文件编码 1
- Hexo+GitHub搭建免费博客
- ThreadPoolExecutor使用和思考(上)-线程池大小设置与BlockingQueue的三种实现区别
- 编程题
- python在IDLE中输入多行
- hadoop hdfs 常用命令大全
- 2017四川省赛 L.Nice Trick【Dp+逆元】
- ansible基本介绍与应用
- Java 8系列之重新认识HashMap
- JavaScript基础总结
- [leetcode]507. Perfect Number
- Cocos2d-x 之简单 UI 及事件