-
详解yii2使用多个数据库的案例
[PHP教程] 2021-01-25 04:43:02 131人阅读
关于yii2配置操作多个数据库进行操作,文档上面也给出了具体的配置,一个实战性的例子,也是很简单的,我们这里以权限控制为单个管理库dbname2,业务库dbname 为例来看看如何配置多个数据库。 No1. 第一步,我们参照...[详细]
-
PHP更安全的密码加密机制Bcrypt详解
[PHP教程] 2021-01-25 04:42:24 71人阅读
前言 我们常常为了避免在服务器受到攻击,数据库被拖库时,用户的明文密码不被泄露,一般会对密码进行单向不可逆加密——哈希。 常见的方式是: 密文越长,在相同机器上,进行撞库消耗的时间越长,相对越安全。 比较...[详细]
-
php下载远程大文件(获取远程文件大小)的实例
[PHP教程] 2021-01-25 04:41:44 130人阅读
废话不多说,直接上代码 $fp = fopen($url,'rb'); if ($fp === false) exit('文件不存在或打开失败'); header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('...[详细]
-
PHP实现下载远程图片保存到本地的方法
[PHP教程] 2021-01-25 04:40:42 92人阅读
在使用 PHP 做简单的爬虫的时候,我们经常会遇到需要下载远程图片的需求,所以下面来简单实现这个需求。 1.使用 curl 比如我们有下面这两张图片: 第一步,我们可以直接来使用最简单的代码实现: 那在下载远程图片的...[详细]
-
Yii2 如何在modules中添加验证码的方法
[PHP教程] 2021-01-25 04:38:47 82人阅读
最近玩了下Yii2的验证码部分,正常的逻辑都可以走通的,网上的例子也是没有问题的,关键有问题的部分是在module中使用的时候,分享给大家,往下看之前可以去看看正常情况下是如何使用的。 controller部分的代码,这...[详细]
-
PHP实现的简单操作SQLite数据库类与用法示例
[PHP教程] 2021-01-25 04:38:11 135人阅读
本篇章节讲解PHP实现的简单操作SQLite数据库类与用法。供大家参考研究具体如下: SQLite是一款轻型的数据库,是遵守ACID的关联式数据库管理系统,它的设计目标是嵌入式的,而且目前已经在很多嵌入式产品中使用了它,...[详细]
-
JS+PHP实现用户输入数字后显示最大的值及所在位
[PHP教程] 2021-01-25 04:33:18 97人阅读
本文主要给大家介绍的是关于JS+PHP实现用户输入数字后显示最大的值及所在位置的相关内容,目的:分清JS PHP的区别,拓宽思维,下面来一起看看详细的介绍: 分析 1.利用JS的prompt输入用户想要输入的值. 2.利用HTML表单...[详细]
-
PHP利用Socket获取网站的SSL证书与公钥
[PHP教程] 2021-01-25 04:32:31 141人阅读
通过 php curl 请求网页并不能获取到证书信息,此时需要使用 ssl socket 获取证书内容。下面来一起看看看详细的介绍: 示例代码: [ 'capture_peer_cert...[详细]
-
php实现批量上传数据到数据库(.csv格式)的案例
[PHP教程] 2021-01-25 04:31:36 91人阅读
友情提示:上传数据的文档需要转化为.csv格式的文档 前端代码: 后端代码:import.php文件 (这里只粘贴主要代码,具体实现方法需自己完成) $fext = substr($_FILES['upfilename']['name'],strrpos($_FILES['upfile...[详细]
-
PHP中模糊查询并关联三个select框
[PHP教程] 2021-01-25 04:07:51 180人阅读
1.在php中我们经常用到下拉框,并相互关联,如果下拉框的option非常多,那么我们就要用到模糊搜索功能,那么怎么做呢? 在此功能中,走了弯路,最好不要关联两个select的id值后select属性选中,并不可修改。再次选择...[详细]
- 这篇文章主要介绍了Laravel 5.0 发布 新版本特性详解,...[详细]
- 计算两个日期之间的时间差需要先把两个日期转换成纪元...[详细]
- 初步使用面向对象程序设计,要掌握的就是使用面向对象...[详细]
- 每个 PHP 数组内部都有一个指针,该指针指向数组的某...[详细]
- 因为 PHP 是一个 Web 编程语言,在编程过程中难免会遇...[详细]
- PHP 中提供了 return 语句来返回函数的运行结果,其语...[详细]
- final 关键字的作用如下: 使用 final 修饰的类,不能...[详细]
- 在使用 switch 语句时应该注意以下几点: 和 if 语句...[详细]
- 这篇文章主要给大家介绍了关于PHP替换Word中变量并导...[详细]
- 这篇文章主要介绍了PHP常量DIRECTORY_SEPARATOR原理及...[详细]