-
PHP利用一行代码删除目录下所有文件方法示例
[PHP教程] 2021-04-01 06:01:37 169人阅读
前言 想必很多人都会写几行甚至几十行代码使其列出所有文件变为数组进行删除,但是glob函数分分钟解决问题!下面来一起看看详细的介绍吧。 glob语法说明: glob() 函数依照 libc glob() 函数使用的规则寻找所有与 pa...[详细]
-
PHP实现判断二叉树是否对称的方法
[PHP教程] 2021-04-01 06:00:46 80人阅读
本篇章节讲解PHP实现判断二叉树是否对称的方法。供大家参考研究具体如下: 问题 请实现一个函数,用来判断一颗二叉树是不是对称的。注意,如果一个二叉树同此二叉树的镜像是同样的,定义其为对称的。 题解 递归判断...[详细]
-
PHP调用ffmpeg对视频截图并拼接脚本
[PHP教程] 2021-04-01 05:47:12 60人阅读
PHP脚本调用ffmpeg对视频截图并拼接,供大家参考,具体内容如下 目前支持MKV,MPG,MP4等常见格式的视频,其他格式有待测试 12P 一张截图平均生成时间 1.64s 100个视频,大概需要2分半左右 9P 一张截图平均生成时间 1...[详细]
-
PHP实现统计一个数字在排序数组中出现次数的方
[PHP教程] 2021-04-01 05:46:18 112人阅读
本篇章节讲解PHP实现统计一个数字在排序数组中出现次数的方法。分享给大家供大家参考,具体如下: 题目 统计一个数字在排序数组中出现的次数。 题解 既然是排序数组,使用二分查找是效率最高的。找到之后再向两侧拓...[详细]
-
PHP各版本中函数的类型声明详解
[PHP教程] 2021-04-01 05:45:21 62人阅读
PHP7开始支持标量类型声明,强类型语言的味道比较浓。使用这个特性的过程中踩过两次坑:一次是声明boolean,最近是声明double。为避免以后继续犯类似错误,就把官方文档翻了一次。本文是看完后对PHP函数的类型声明使...[详细]
-
PHP使用两个栈实现队列功能的方法
[PHP教程] 2021-04-01 05:43:43 192人阅读
本篇章节讲解PHP使用两个栈实现队列功能的方法。供大家参考研究具体如下: 问题 用两个栈来实现一个队列,完成队列的Push和Pop操作。 队列中的元素为int类型。 解决思路 两个栈。出栈的时候,如果栈2不为空,就出栈2...[详细]
-
PHP基于非递归算法实现先序、中序及后序遍历二
[PHP教程] 2021-04-01 05:42:45 134人阅读
本篇章节讲解PHP基于非递归算法实现先序、中序及后序遍历二叉树操作。供大家参考研究具体如下: 概述: 二叉树遍历原理如下: 针对上图所示二叉树遍历: ABDHECFG HDBEAFCG HDEBFGCA 实现方法: 先序遍历: 利用栈先...[详细]
-
MixPHP、Yii和CodeIgniter的并发压力测试小结
[PHP教程] 2021-04-01 05:42:06 102人阅读
前言 MixPHP 是一个基于 Swoole 的高性能框架,CodeIgniter 是一个元老级的轻量级框架,Yii 是一个非常流行的框架,以下是三个框架的对比。 由于Yii/CodeIgniter 是基于 Apache/PHP-FPM 的传统框架,如果使用 MixPHP...[详细]
-
Yii2中的场景(scenario)和验证规则(rule)详解
[PHP教程] 2021-04-01 05:41:19 123人阅读
前言 场景,顾名思义,就是一个情景,一种场面。在yii2中也有场景,这个场景跟你所理解的场景含义差不多。 和用户有交互的系统必不可少的功能包括收集用户数据、校验和处理。实际业务中,往往还需要将数据进行持久化...[详细]
-
PHP7扩展开发之基于函数方式使用lib库的方法详
[PHP教程] 2021-04-01 05:35:06 187人阅读
本篇章节讲解PHP7扩展开发之基于函数方式使用lib库的方法。供大家参考研究具体如下: 前言 首先说下什么是lib库。lib库就是一个提供特定功能的一个文件。可以把它看成是PHP的一个文件,这个文件提供一些函数方法。只...[详细]
- 这篇文章主要介绍了Laravel 5.0 发布 新版本特性详解,...[详细]
- 计算两个日期之间的时间差需要先把两个日期转换成纪元...[详细]
- 初步使用面向对象程序设计,要掌握的就是使用面向对象...[详细]
- 每个 PHP 数组内部都有一个指针,该指针指向数组的某...[详细]
- 因为 PHP 是一个 Web 编程语言,在编程过程中难免会遇...[详细]
- PHP 中提供了 return 语句来返回函数的运行结果,其语...[详细]
- final 关键字的作用如下: 使用 final 修饰的类,不能...[详细]
- 在使用 switch 语句时应该注意以下几点: 和 if 语句...[详细]
- 这篇文章主要给大家介绍了关于PHP替换Word中变量并导...[详细]
- 这篇文章主要介绍了PHP常量DIRECTORY_SEPARATOR原理及...[详细]