-
PHP 访问数据库配置通用方法(json)
[PHP教程] 2021-05-25 01:48:38 173人阅读
提取一种对数据库配置的通用方式 目的是通过通用类访问配置文件的方式,提供对数据库连接的动态获取和设置,使开发时和生产应用时都能够提供灵活的、简化的、解耦的操作方式。比如在配置文件中配置好两套数据库访问...[详细]
-
PHP生成腾讯云COS接口需要的请求签名
[PHP教程] 2021-05-25 01:46:59 57人阅读
COS和请求签名是什么 COS 是腾讯云对象存储的缩写及简称,请求签名是第三方在调用COS相关接口时需要按需提供的、经过特定算法创建而成的一组字符串信息,将唯一的标识当前第三方身份,提供通信双方的身份识别,只有...[详细]
-
PHP实现将多个文件压缩成zip格式并下载到本地的
[PHP教程] 2021-05-25 01:45:47 194人阅读
本篇章节讲解PHP实现将多个文件压缩成zip格式并下载到本地的方法。供大家参考研究具体如下: 废话不多说,直接上代码 open($zipname,ZipArchive::CREATE);if ($res === TRUE) { foreach ($files as $file) { //这里...[详细]
-
PHP实现的mysql读写分离操作示例
[PHP教程] 2021-05-25 01:45:15 97人阅读
本篇章节讲解PHP实现的mysql读写分离操作。供大家参考研究具体如下: 首先mysql主从需配置好,基本原理就是判断sql语句是否是select,是的话走master库,否则从slave查 '; $link = mysql_connect("192.168.20.201:33...[详细]
-
PHP基于pdo的数据库操作类【可支持mysql、sqlse
[PHP教程] 2021-05-25 01:44:34 99人阅读
本篇章节讲解PHP基于pdo的数据库操作类。分享给大家供大家参考,具体如下: 工作中需要操作sqlserver、oracle都是使用的这个类,当时是在别人的基础上改进了,现在分享下 Config = $config; $this->connect(); } /*...[详细]
-
PHP仿tp实现mvc框架基本设计思路与实现方法分析
[PHP教程] 2021-05-25 01:43:42 167人阅读
本篇章节讲解PHP仿tp实现mvc框架基本设计思路与实现方法。供大家参考研究具体如下: 仿tp mvc基本设计与简单实现 一:文件加载常识 变量 常量 函数 类文件加载的函数或者使用命名空间: require(); require_once(); ...[详细]
-
PHP自定义函数实现assign()数组分配到模板及ext
[PHP教程] 2021-05-25 01:42:02 82人阅读
本篇章节讲解PHP自定义函数实现assign()数组分配到模板及extract()变量分配到模板功能。供大家参考研究具体如下: 这里模拟tp框架模板变量分配与赋值操作。 extract($arr); //extract 的作用:从数组中将变量导入到...[详细]
-
PHP工厂模式简单实现方法示例
[PHP教程] 2021-05-25 01:41:16 61人阅读
本篇章节讲解PHP工厂模式简单实现方法。供大家参考研究具体如下: 工厂模式是一种类,建立了一个工厂来根据所需来创建对象,这种方式在多态性编程中是很重要的,允许动态替换类,修改配置等。 php示例代码如下: cla...[详细]
-
PHP递归遍历文件夹去除注释并压缩php源代码的方
[PHP教程] 2021-05-25 01:39:52 164人阅读
本篇章节讲解PHP递归遍历文件夹去除注释并压缩代码的方法。供大家参考研究具体如下: "; } } } }else{ // 此处无用(因为来的都是目录),如果只转换一个文件,就可以这样使用。 file_put_contents($arr[1].'/'.$dir...[详细]
-
CI框架(CodeIgniter)实现的导入、导出数据操作
[PHP教程] 2021-05-25 01:39:15 137人阅读
本篇章节讲解CI框架(CodeIgniter)实现的导入、导出数据操作。供大家参考研究具体如下: 在libraies中引用PHPExcel这个类(phpexcel.php) 'name','C...[详细]
- 这篇文章主要介绍了Laravel 5.0 发布 新版本特性详解,...[详细]
- 计算两个日期之间的时间差需要先把两个日期转换成纪元...[详细]
- 初步使用面向对象程序设计,要掌握的就是使用面向对象...[详细]
- 每个 PHP 数组内部都有一个指针,该指针指向数组的某...[详细]
- 因为 PHP 是一个 Web 编程语言,在编程过程中难免会遇...[详细]
- PHP 中提供了 return 语句来返回函数的运行结果,其语...[详细]
- final 关键字的作用如下: 使用 final 修饰的类,不能...[详细]
- 在使用 switch 语句时应该注意以下几点: 和 if 语句...[详细]
- 这篇文章主要给大家介绍了关于PHP替换Word中变量并导...[详细]
- 这篇文章主要介绍了PHP常量DIRECTORY_SEPARATOR原理及...[详细]