![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
php
文章平均质量分 68
向右看齐--
这个作者很懒,什么都没留下…
展开
-
php74 安装sodium
这样的问题需要确认 安装libsodium时是否执行了。核对导入/usr/lib/pkgconfig路径。原创 2023-10-16 11:56:32 · 631 阅读 · 0 评论 -
PHP 腾讯与百度坐标转换
/** * 腾讯转百度坐标转换 * @param $a Latitude * @param $b Longitude * @return array */function coordinate_switchf($a, $b)//腾讯转百度坐标转换 $a = Latitude , $b = Longitude{ $x = (double)$b ; $y = (dou...原创 2019-12-07 11:20:57 · 424 阅读 · 0 评论 -
session_start(): Failed to initialize storage module: user
出现问题::(session_start(): Failed to initialize storage module: user (path: D:\phpStudy\PHPTutorial\tmp\tmp)错误位置FILE: D:\www\other\crm\Core\ThinkPHP\Common\functions.php LINE: 1265ThinkPHP3.2....原创 2019-10-27 16:12:31 · 3112 阅读 · 0 评论 -
yii2 生成二维码(2)
1. 使用:"2amigos/yii2-qrcode-helper" : "*",可以直接生成二维码 缺点是不能生成带logo的二维码(我没找到 有找到的可以告诉我下)use dosamigos\qrcode\lib\Enum;use dosamigos\qrcode\QrCode;public function actionQrcode(){ $id = intval...原创 2019-01-22 14:32:00 · 1166 阅读 · 0 评论 -
php sftp文件上传 下载 删除
<?php/** * 测试sftp 连接及下载远程文件 */$config = [ 'host' => '192.168.1.111', 'username'=>'root', 'password'=>'', 'port'=>'22',];$localPath = 'D:\\jaja\\php1\\';//本地存储路径...原创 2019-01-16 16:18:17 · 553 阅读 · 0 评论 -
PHP 文件上传时返回为空数组
PHP 文件上传时打印$_FILES,返回为空数组array(0){}出现的问题可能是在表单中没有写 enctype="multipart/form-data"原创 2019-01-16 14:26:50 · 509 阅读 · 0 评论 -
yii2.0 redirect 无法正常跳转 beforeAction
最近在开发功能中 发现redirect竟然不能正常跳转,查了好长时间,还以为写的代码有问题,主要是在beforeAction中做了是否登录的判断,未登录则跳转到登录页面,所有的类继承的这个baseControllerpublic function beforeAction($action) { if(parent::beforeAction($action)) ...转载 2019-01-26 18:32:53 · 962 阅读 · 0 评论 -
centos7 安装php扩展-ssh2
centos7 安装php扩展-ss21. 安装ssh2的依赖yum install libssh2 libssh2-devel 2. 安装ssh2首先下载ssh2 地址:http://pecl.php.net/package/ssh2 v1.0 以上是php7相关wget http://pecl.php.net/get/ssh2-1.1.2.tgztar zxvf...原创 2019-01-15 15:30:46 · 1830 阅读 · 1 评论 -
windows 下通过bat文件 执行PHP脚本
1、建立PHP脚本,如下:go.php<?phpfile_put_contents('D:\\www\\1.txt','ok');?>使用绝对路径,否则代码将正确执行但是文件将不会被创建。 2、新建go.bat文件,代码如下:"D:\xampp\php\php.exe" -f "D:\www\go.php"在命令行执行php 的前提是将php加入到环境变量...原创 2019-01-17 11:04:10 · 4669 阅读 · 0 评论 -
YII2 joinWith的使用实例
1.首先要有两个模型投票劵表(vote_conpon_type) 模型为 VoteCouponType投票券子表(vote_coupon) 模型为 VoteCoupon模型VoteCouponType必填内容:public function getVoteCoupon(){ return $this->hasMany(VoteCoupon:...转载 2019-04-16 10:09:28 · 1146 阅读 · 0 评论 -
已知一点坐标(经纬度),如何判断其方圆500米的范围?
你可以先算出该点周围的矩形的四个点,然后使用经纬度去直接匹配数据库中的记录;如下图参考wiki百科上的一些球面计算公式:假设已知点的经纬度分别为$lng, $lat先实现经度范围的查询,在haversin公式中令φ1 = φ2,可得:用PHP进行计算,就是: $dlng = 2 * asin(sin($distance / (2 * self::EARTH_RADIUS)...转载 2019-04-17 14:16:48 · 10918 阅读 · 1 评论 -
小程序 图片上传 及后台PHP接收文件
相关连接:https://developers.weixin.qq.com/miniprogram/dev/api/wx.chooseImage.htmlhttps://developers.weixin.qq.com/miniprogram/dev/api/wx.uploadFile.html前台代码wxml:<view bindtap="shopLogoChange"&...原创 2019-10-30 08:59:23 · 362 阅读 · 0 评论 -
Windows+PHP5.6环境下安装imagick扩展和imagemagick
查看phpinfo()信息 其实回过头看,安装过程中最容易出错的反而是下载阶段,一定要将imagemagick和imagick的版本和phpinfo的信息对应好!下图中几点需要注意,每个人的信息可能不同,根据你自己的phpinfo来选择接下来的下载的程序及扩展版本:PHP Version:PHP版本 compiler:MSVC11 Architecture:x86 Thre...转载 2019-04-25 13:51:18 · 833 阅读 · 2 评论 -
tp3.2 class "Redis: not found
php5.6 xampp 环境出现class "Redis: not found解决方法:PHP环境安装redis 扩展1、根据phpinfo 中的vc库版本,下载redis下载地址:注意php版本号http://windows.php.net/downloads/pecl/releases/redis/2.2.7/http://windows.php.net...原创 2019-05-16 09:22:15 · 1691 阅读 · 0 评论 -
php读取excel中的时间转换问题
今天要做数据导入:把2012-5-10 16:00:00读入到php中后变成了41039.666666667这种Excel列的单元格格式为日期单元格式,如果是文本格式则会得到我们想要的原样的字符串类型。转换方法一:$t = 41807; //读取到的值$n = intval(($t - 25569) * 3600 * 24); //转换成1970年以来的秒数 转换完成就是Exce...转载 2019-06-02 19:34:49 · 1452 阅读 · 1 评论 -
php 字符串去除Html所有标签、空格以及空白
//字符串去除Html所有标签、空格以及空白function cutstr_html($string){ $string = strip_tags($string); $string = trim($string); $string = ereg_replace("\t","",$string); $string = ereg_replace("\r\n",""...转载 2019-06-25 18:17:38 · 928 阅读 · 0 评论 -
tp3.2 与tp5 tp与yii tp与laravel
////////////////////////////////tp5和tp3.2的区别:1. URL和路由的变化5.0的URL访问不再支持普通URL模式,路由也不支持正则路由定义,而是全部改为规则路由配合变量规则(正则定义)的方式:主要改进如下;增加路由变量规则;增加组合变量支持;增加资源路由;增加路由分组;增加闭包定义支持;增加MISS路由定义;支持URL路由规则反解析;...原创 2019-08-23 16:46:42 · 622 阅读 · 0 评论 -
php 验证是否为https
/** * 是否为https * @return bool */public static function is_https(){ if (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') { return true; } elseif ( iss...原创 2018-09-11 10:03:16 · 1089 阅读 · 0 评论 -
php 获取图片url
提取字符串中的图片地址[正则表达式]$oldContent = '<p><img src="//dev.gw.woyaobaoxiu.cn/uploads/ueditor/image/20180911/153662877574057006.jpg" width="622" height="157" style="width: 622px; height: 157px;"&g原创 2018-09-11 09:46:59 · 2011 阅读 · 0 评论 -
yii2 获取redis缓存信息
//获取redis 缓存个数$cache = Yii::$app->cache->redis;$size = $cache->executeCommand('DBSIZE');//根据key获取redis值$key = '*';if($name = trim($_GET['name'])) { $key = $name . $key;}$data = $...原创 2018-09-13 11:04:30 · 1005 阅读 · 0 评论 -
PHP 文件上传时返回为空数组
PHP 文件上传时打印$_FILES,返回为空数组array(0){}1. 出现的问题可能是在表单中没有写 enctype="multipart/form-data"action="" method="post" enctype="multipart/form-data">2. 在php.ini中必须开启file_uploads=on该选项的作用是配置是否允许上传文件。如果原创 2018-03-27 15:59:57 · 924 阅读 · 0 评论 -
(实用篇)PHP ftp上传文件操作类
此文章来源于:https://www.cnblogs.com/zhangmiaomiao/p/6013347.html<?php/** * 作用:FTP操作类( 拷贝、移动、删除文件/创建目录 ) */class class_ftp{ public $off; // 返回操作状态(成功/失败) public $conn_id; // FTP连接 const ...转载 2018-01-08 13:47:39 · 1224 阅读 · 0 评论 -
PHPExcel 生成excel表
$excel = new \PHPExcel();$excel->setActiveSheetIndex(0);$letter = [];$i = 'A';for ($n=0; $n26; $n++) { $letter[$n] = $i++;}$array = $_GET['post'];$array = json_decode($array);//$array是要保存的数原创 2018-01-15 18:21:13 · 155 阅读 · 0 评论 -
ThinkPHP5.0的助手函数汇总
http://www.thinkphp.cn/topic/42108.html转载 2017-12-26 13:30:30 · 574 阅读 · 0 评论 -
ThinkPHP3.2.3的函数汇总
本文只是将functions里面的函数汇总了一下,方便查阅C:获取和设置配置参数 支持批量定义/** * 获取和设置配置参数 支持批量定义 * @param string|array $name 配置变量 * @param mixed $value 配置值 * @param mixed $default 默认值 * @return mixed */C转载 2017-12-26 13:01:26 · 924 阅读 · 0 评论 -
TP3.2与TP5.0的区别
1. 控制器输出return $this->fetch(); ----5$this->display(); ----3.2单字母函数去掉了 如:M() D() U() S() C()3.2 ---------5G() --------- debug() 记录时间(微秒)和内存使用情况E() --------- exception() 抛出异常处理C() ----原创 2017-12-26 10:18:41 · 5822 阅读 · 0 评论 -
curl get与post请求
curl说明: cURL 是一个利用URL语法规定来传输文件和数据的工具,支持很多协议,如HTTP、FTP、TELNET等。最爽的是,PHP也支持 cURL 库。curl的get请求://https get提交function getHTTPS($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_SSL原创 2017-12-25 22:00:24 · 695 阅读 · 0 评论 -
thinkphp 3.2 基础
ThinkPHP:MVC框架Model 模型(数据库操作)View 视图(页面显示)Controller 控制器(逻辑处理)优点1、代码分工更加明确2、便于网站的维护与管理(便于二次开发)特点1、国内程序员研发2、轻量级框架3、集成Smarty模板引擎4、封装类5、目录自动生成6、项目单一入口命名空间namespace:从php5原创 2017-12-25 10:53:17 · 529 阅读 · 0 评论 -
win7 通过xampp安装composer
安装composer步骤:1.下载composer.phar下载地址:https://getcomposer.org/download/下载了最新版本(错误1)原创 2018-05-09 21:52:57 · 455 阅读 · 0 评论 -
yii2 使用Ueditor 报错:请求后台配置项http错误,上传功能将不能正常使用!
yii2中引入Ueditor :在composer.json中添加:"crazydb/yii2-ueditor": "*",再composer update之前使用的Ueditor 并没有出现什么问题 ,今天再次使用时出现了问题:GET http://xxx.cn/ueditor/index?action=config&&noCache=1527044296955 500 (Int...原创 2018-05-23 11:09:52 · 3966 阅读 · 0 评论 -
tp3.2.3 for标签出现的错误:XML标签语法错误 : start="1" end="
上编代码出现以下错误: 对出现的问题更改结果:原创 2018-09-12 22:11:28 · 1197 阅读 · 0 评论 -
php 解决date('Y-m',strtotime('-1 month'))得到上个月是错的
/** * 解决2017-01-31 (-1 month)还显示1月的问题 */$data = "2017-1-31";$base = strtotime(date('Y-m',strtotime($data)) . '-01 00:00:01');echo date('Y-m',strtotime('-1 month', $base));获取前6个月的月份/** * 获取...原创 2018-08-31 17:29:08 · 4848 阅读 · 0 评论 -
yii2 DateTimePicker简单使用
yii2 使用DatePicker类 参考:https://www.cnblogs.com/l-zl/p/7373358.html在使用DatePicker类时发现没有 时分 的设置,所有选择了DateTimePicker类 安装如下composer.json中添加 :"2amigos/yii2-date-time-picker-widget" : "*",<?phpu...原创 2018-08-20 16:36:19 · 1980 阅读 · 0 评论 -
高德地图 点击获取坐标
<link href="<?=Yii::getAlias('@resUrl/css/manage.css');?>" rel="stylesheet"><div class="panel panel-default"> <div class="panel-body"> <原创 2018-08-10 15:00:24 · 6911 阅读 · 0 评论 -
yii2 生成二维码
composer 安装 php composer.phar require 2amigos/qrcode-library:~1.1or add "2amigos/qrcode-library": "~1.1"<?phpuse Da\QrCode\Contracts\ErrorCorrectionLevelInterface;use Da\QrCode\Qr...原创 2018-08-09 16:41:23 · 4122 阅读 · 0 评论 -
php 获取一个月的所有时间
/** * 获取某月所有时间 * @param string $time 某天时间戳 * @param string $format 转换的时间格式 * @return array */public static function getMonth($time = '', $format='Y-m-d'){ $time = $time != '' ? $time : time...原创 2018-08-09 10:39:11 · 3375 阅读 · 0 评论 -
yii2 phpexecl导入
composer require phpoffice/phpexcel : "*"$fileType = \PHPExcel_IOFactory::identify($file);$excelReader = \PHPExcel_IOFactory::createReader($fileType);$phpExcel = $excelReader->load($file)-&g...原创 2018-07-23 17:00:32 · 808 阅读 · 0 评论 -
ImageMagick及PHP的imagick扩展的安装及配置
参考: https://www.cnblogs.com/xiangxiaodong/archive/2013/12/23/3487008.htmlimagick是一个PHP的扩展,用ImageMagick提供的API来进行图片的创建与修改,不过这些操作已经包装到扩展imagick中去了,最终调用的是ImageMagick提供的APIImageMagick是一套软件系列,主要用于图片的创建、编辑以及...原创 2018-06-21 17:34:04 · 6332 阅读 · 0 评论 -
centos7 离线安装PHP及PHP相关扩展
1、安装PHP7 下载地址 http://hk1.php.net/get/php-7.2.0.tar.gz/from/this/mirror下载php7(php-7.1.12.tar.gz)包导入centos7 /data/rj2.解压包 tar -zxvf php-7.1.12.tar.gz 3.安装php 之前需要安装mcrypt 1).下载Libmcryp...原创 2017-12-21 14:07:54 · 7425 阅读 · 10 评论