![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
php开发
菜冬眠。
这个作者很懒,什么都没留下…
展开
-
php遍历文件夹、文件
php遍历文件夹、文件<?php $path = '/'; foreach_file($path);//传入需要遍历的文件夹路径function foreach_file($path) { if(is_dir($path))//判断目录是否存在 { //opendir()返回一个目录句柄,失败返回false if($current_dir = open原创 2017-05-25 14:01:27 · 317 阅读 · 0 评论 -
php 字符串操作
php 字符串操作 去掉尖括号及之间的内容 preg_replace('/\<.*?\>/', '',$str); 去掉横杆/空格/冒号等 str_replace("-","",$str); str_replace(" ","",$str); str_replace(":","",$str); 去掉前几位、后几位 substr($str,5); substr($str,-5); ...原创 2019-05-21 11:34:38 · 453 阅读 · 0 评论 -
layui 富文本 图片上传 后端PHP接口
layui 富文本 图片上传 后端PHP接口html<!DOCTYPE html> <html> <head> <link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css"> <script type="text/javascript" src='/static/js/jquery-3.2.1.mi原创 2017-08-09 16:10:31 · 4844 阅读 · 1 评论 -
php 封装接口类返回json/xml数据
php 封装接口类返回json/xml数据response.php<?phpclass Response { /* *按json格式返回数据 *@param int $code 状态码 *@param string $message 提示信息 *@param arrya $data 数据 *return string */ publi原创 2017-08-05 15:41:44 · 699 阅读 · 0 评论 -
Thinkphp3.2.3 多数据库配置
Thinkphp 多数据库配置同时需要连接多个数据库时,配置及使用方法。return array( //'配置项'=>'配置值' 配置一个默认的数据库,和一个叫model2的数据库 'DB_DSN' => 'mysql://root:123456@192.168.3.237:3306/test', 'model2' => array('DB_TYPE' => 'mysql',原创 2017-05-06 11:48:18 · 2981 阅读 · 0 评论 -
mac下安装php-redis扩展
mac下安装php-redis扩展操作系统版本:10.12.5。下载php-redis,地址:https://nodeload.github.com/nicolasff/phpredis/zip/master下载完成得到phpredis-master.zip移动到/usr/local/目录中sudo cp phpredis-master /usr/local/进入/usr/local/目录cd /u原创 2017-08-05 12:13:47 · 9200 阅读 · 4 评论 -
php使用phpexcel类操作excel文件数据
php使用phpexcel类操作excel文件数据首先下载phpexcel git地址:https://github.com/PHPOffice/PHPExcel/releases 这里下载了1.8.1.zip解压之后进入目录,Classes目录,复制PHPExcel.php和PHPExcel文件夹,文件和文件夹要放在同一目录。读取excel文件header("Content-type: text原创 2017-08-04 12:23:03 · 388 阅读 · 0 评论 -
php mysqli 操作数据库
php mysqli 操作数据库//连接数据库 $Ip = '119.23.70.107'; $User = 'root'; $Pwd = '123456'; $db = 'filetest'; $con = new mysqli($Ip,$User,$Pwd,$db); //判断连接 if ($con->connect_errno) { echo "db Connect f原创 2017-05-16 12:23:12 · 301 阅读 · 0 评论 -
php curl ftp 下载文件
php curl ftp 下载文件不知道为什么用正常的ftp_get函数下载文件速度特别慢,但是用ftp的客户端下载很快,所以换了curl的下载方式,速度正常function file_upload($ftpIp,$ftpUser,$ftpPwd,$path,$fileSavePath){ $curlobj = curl_init();//初始化 //传入ftp的目标文件,如'ftp原创 2017-05-16 12:17:39 · 649 阅读 · 0 评论 -
php zip打包文件批量下载
php zip打包文件批量下载 $zipname = 'file.zip'; //file_path为文件位置,这里用的是thinkphp,路径为相对于入口文件index.php的位置, //down_path为打包后文件的文件名 if(file_exists($res['zpstr1'])){ $fileArr[0] = array('file_path' => './1.jpg', '...转载 2019-05-21 11:45:58 · 807 阅读 · 0 评论