-
浅谈PHP错误类型及屏蔽方法
[PHP教程] 2021-01-16 12:01:56 81人阅读
程序只要在运行,就免不了会出现错误,错误很常见,比如Error,Notice,Warning等等。在PHP中,主要有以下3种错误类型。 1.注意(Notices) 这些都是比较小而且不严重的错误,比如去访问一个未被定义的变量。通常,...[详细]
-
PHP网站自动化配置的实现方法(必看)
[PHP教程] 2021-01-16 11:48:53 173人阅读
一直都在用yii2做项目,有在用自动化配置,但是没有自己去配置过。中午没事去看了下yii的初始化代码,发现都是php而已! yii2 初始化项目代码 所以,我们做项目肯定是可以用php做的,于是我新建了个文件夹,名为auto...[详细]
-
PHP中的函数声明与使用详解
[PHP教程] 2021-01-16 11:48:31 147人阅读
函数 1. 函数名是标识符之一,只能有字母数字下划线,开头不能是数字; 函数名的命名,必须符合“小驼峰法则” FUNC(),func(),Func(); 函数名不区分大小写; 函数名不能与已有函数同名,不能与内置函数名同名; 2. fu...[详细]
-
PHP实现的简单AES加密解密算法实例
[PHP教程] 2021-01-16 11:47:44 54人阅读
本篇章节讲解PHP简单AES加密解密算法。供大家参考研究具体如下: PS:关于加密解密感兴趣的朋友还可以参考本站在线工具: 文字在线加密解密工具(包含AES、DES、RC4等): MD5在线加密工具: 在线散列/哈希算法加密工...[详细]
-
PHP编程求最大公约数与最小公倍数的方法示例
[PHP教程] 2021-01-16 11:47:18 67人阅读
本篇章节讲解PHP编程求最大公约数与最小公倍数的方法。供大家参考研究具体如下: 1; $i--) { if (is_int($a/$i)is_int($b/$i)) { return $i; //此处如果用echo $i;则输出结果为432;故应区分echo、return的区别 } } ...[详细]
-
使用一个for循环将N*N的二维数组的所有值置1实
[PHP教程] 2021-01-16 11:46:36 170人阅读
// 使用一个for循环将N*N的二维数组的所有值置1 $n = 3; $a = []; for($i=0;$i$n*$n;$i++){ $a[$i/$n][$i%$n] = 1; } print_r($a); 以上这篇使用一个for循环将N*N的二维数组的所有值置1实现方法就是小编分享给大家的...[详细]
-
PHP 网站修改默认访问文件的nginx配置
[PHP教程] 2021-01-16 11:45:53 130人阅读
搭建好lnmp后,有时候并不需要直接访问index.php,配置其他的默认访问文件比如index.html这时候需要配置一下nginx才能访问到你想要设置的文件 直接上代码,如下是我的配置的一份简单的nginx到php-fpm的站点,该站点...[详细]
-
yii插入数据库防并发的简单代码
[PHP教程] 2021-01-16 11:44:50 134人阅读
分享yii的一段有用的代码: 当需要让数据库某字段自增时,比如统计每天的查询量,每次请求后都把request_count+1, 如果这样写: request_count++;$flag = $model->save(); 遇到并发时会不准确,可改为: new \yii\db...[详细]
-
PHP编程计算两个时间段是否有交集的实现方法(不
[PHP教程] 2021-01-16 11:43:17 178人阅读
本篇章节讲解PHP编程计算两个时间段是否有交集的实现方法。分享给大家供大家参考,具体如下: 优化前的版本: 0) { $status2 = $beginTime2 - $endTime1; if ($status2 > 0) { return false; } elseif ($status2 0) ...[详细]
-
php实现数组纵向转横向并过滤重复值的方法分析
[PHP教程] 2021-01-16 11:42:14 126人阅读
本篇章节讲解php实现数组纵向转横向并过滤重复值的方法。分享给大家供大家参考,具体如下: 一、问题 有数组: array(5=>'黑xx',42=>'XXL'),7=>array(5=>'黑xx',40=>'XL'),8=>array(8=>'灰',); 要求转换成如下结果(...[详细]
- 这篇文章主要介绍了Laravel 5.0 发布 新版本特性详解,...[详细]
- 计算两个日期之间的时间差需要先把两个日期转换成纪元...[详细]
- 初步使用面向对象程序设计,要掌握的就是使用面向对象...[详细]
- 每个 PHP 数组内部都有一个指针,该指针指向数组的某...[详细]
- 因为 PHP 是一个 Web 编程语言,在编程过程中难免会遇...[详细]
- PHP 中提供了 return 语句来返回函数的运行结果,其语...[详细]
- final 关键字的作用如下: 使用 final 修饰的类,不能...[详细]
- 在使用 switch 语句时应该注意以下几点: 和 if 语句...[详细]
- 这篇文章主要给大家介绍了关于PHP替换Word中变量并导...[详细]
- 这篇文章主要介绍了PHP常量DIRECTORY_SEPARATOR原理及...[详细]