
PHP
懒人笔记—001
欢迎讨论、不喜勿喷;本人不喜欢写博客,几乎来自记事本或有道笔记的粘贴的过往或者现在的笔记,更多的是自己记录自己过往遇到小问题解决小问题的点滴,很多问题随着时间的过往已经感觉不应该当问题,但是还是贴出来了,供新人参考供自己回忆
展开
-
php 身份证号码处理相关函数
/** * 身份证号码验证 * @param $id * @return bool */private function isValidCard($id){ if (18 != strlen($id)) { return false; } $weight = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]; $code = ['1', '0', 'X', '9', '8', '7', '.原创 2021-05-20 09:46:12 · 428 阅读 · 0 评论 -
laravel判断使用查询构造器和模型查询的结果是否为空
laravel判断使用查询构造器和模型查询的结果是否为空的三个方法(laravel框架封装好的原创 2021-05-10 16:27:00 · 909 阅读 · 0 评论 -
NGINX index.php 入口文件识别不了
场景:nginx配置好后,index.php 识别不了,直接跳过index.php 识别index.html ,删除index.html后,直接报错403 Forbidden解决办法一:没有indx.html就添加一个index.html空文件,在nginx配置文件中server 模块中添加一个重写规则即可rewrite ^/index.html(.*)$ /index.phppermanent;...原创 2021-04-27 13:44:27 · 1097 阅读 · 0 评论 -
laravel 相关文档地址
中文文档https://learnku.com/docs/laravel/8.x/开发规范https://learnku.com/docs/laravel-specification/8.x速查表https://learnku.com/docs/laravel-cheatsheet/8.x原创 2021-04-13 23:01:09 · 188 阅读 · 0 评论 -
deepin20 PHP 7.2GD库 无法启用 freetype的问题 “freetype-config not found”
本次测试主要借鉴一下文章,,本次环境(deepin20,php7.2)环境:Ubuntu 19.04 (Disco)PHP 7.3.5我在编译安装 PHP 时,遇到了 “freetype-config not found”的问题。网上大多数的解决方案,都是尝试安装 libfreetype6-devapt-get install libfreetype6-dev但是依然报错。这是由于在 Ubuntu 19.04 中 apt-get 安装的 libfreetype6-dev 版.转载 2021-03-11 10:35:15 · 2061 阅读 · 0 评论 -
Laravel 中文文档网址(PHP)
https://learnku.com/docs/laravel原创 2019-11-08 18:23:53 · 338 阅读 · 0 评论 -
websocket-php简易聊天(保持网页数据通讯)
需要安装 swoole扩展在linux系统下通过命令行执行php文件。(win下没有swoole扩展)示例代码1. 前端websocket<html><head> <meta charset="UTF-8"> <title>Web sockets test</title> &l...转载 2019-08-26 08:49:26 · 440 阅读 · 0 评论 -
[转发] 微信支付代码片段tp [思路比较全]
PHP微信支付开发过程,分享给大家,供大家参考,具体内容如下1.开发环境Thinkphp 3.2.3微信:服务号,已认证开发域名:http://test.paywechat.com (自定义的域名,外网不可访问)2.需要相关文件和权限微信支付需申请开通微信公众平台开发者文档:http://mp.weixin.qq.com/wiki/home/index.html微信支付开发者文...转载 2017-10-25 17:04:41 · 376 阅读 · 0 评论 -
ubuntu PHP Cannot adopt OID in UCD-SNMP-MIB
Cannot adopt OID in UCD-SNMP-MIB:Cannot adopt OID in LM-SENSORS-MIB: lmTempSensorsValue运行PHP遇到这些错误怎么办?安装两个软件就行!他们分别是:getcomposer和snmp-mibs-downloader下载:curl -sS https://getcomposer.org/inst...原创 2019-10-28 11:43:36 · 1421 阅读 · 0 评论 -
Linux下全局安装composer方法
1、下载composercurl -sS https://getcomposer.org/installer | php2、将composer.phar文件移动到bin目录以便全局使用composer命令mv composer.phar /usr/local/bin/composer3、切换国内源composer config -g repo.packagist composer h...原创 2019-10-24 10:10:35 · 602 阅读 · 0 评论 -
PHP简单实现单点登录
这篇文章主要介绍了PHP简单实现单点登录功能,结合实例形式分析了php基于session控制实现单点登录的相关操作技巧,需要的朋友可以参考下(主要是提供一种单点登录的思路之一,单点登录的方式很多种)本文实例讲述了PHP简单实现单点登录功能。分享给大家供大家参考,具体如下:1.准备两个虚拟域名127.0.0.1 www.openpoor.com127.0.0.1 www.mysp...转载 2019-10-24 10:02:24 · 387 阅读 · 0 评论 -
懒人centos7.5安装lam5.6p7.2
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpmrpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpmyum -y install php72w php72w-cli php72w-common php72w-devel php72w-embed...原创 2019-08-13 10:24:42 · 344 阅读 · 0 评论 -
编译安装php时的一些configure 参数整理
一些编译php时的configure 参数 ./configure –prefix=/usr/local/php7 php 安装目录 –with-apxs2=/usr/local/apache/bin/apxs –with-config-file-path=/usr/local/php/etc 指定php.ini位置 ...原创 2019-08-13 10:05:37 · 986 阅读 · 0 评论 -
linux 编译安装php7.3报错[checking for cURL 7.10.5 or greater... configure: error: cURL version 7.10.5 or ]
configure 报错:checking for cURL in default path... found in /usr/localchecking for cURL 7.10.5 or greater... configure: error: cURL version 7.10.5 or later is required to compile php with cURL suppo...原创 2019-08-19 09:48:37 · 6760 阅读 · 1 评论 -
centos7编译安装php7.1,7.2,7.3 网址整理
根具个人近几年的经验个人觉得安装各种软件除了特殊情况不建议编译安装,编译安装你也是用别人的源码,莫非就是自己指定了部分目录和库版本等等(也就是configure这一块的参数,其他的莫非就是那九个命令而已,如果对linux不熟悉的人那么以后加其他扩展相对就难点麻烦点,很多不能直接yum install **** 或者 apt-get install*** 进行安装,大多数人用直接在线安装...原创 2019-10-28 12:06:25 · 973 阅读 · 0 评论 -
php发邮件出现主题里面有空格换行
1、原因,第三方‘PHPMail’控件类里面定义了最大行显示长度为76,当超过76就会自动换行2、解决办法,在PHPMail类里面修改其指定值 /** * The lower maximum line length allowed by RFC 2822 section 2.1.1. * This length does NOT include the line ...原创 2019-07-13 11:25:48 · 1187 阅读 · 0 评论 -
ubuntu16.04 PHP7 [ could not find driver]
could not find driverroot@hello:/etc/apache2/sites-available# php -vPHP 7.3.6-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: May 31 2019 11:06:48) ( NTS )Copyright (c) 1997-2018 The PHP GroupZen...原创 2019-06-11 21:35:51 · 946 阅读 · 0 评论 -
php时区设置后获取各不相同????
php.ini :[CLI Server]; Whether the CLI web server uses ANSI color coding in its terminal output.cli_server.color = On[Date]; Defines the default timezone used by the date functions; http://ph...原创 2019-06-11 14:01:20 · 276 阅读 · 0 评论 -
NGINX和PHP 使用SOCKET通信错误 An error occurred.
环境:centos7.5 、NGINX、PHP7.2 (php和nginx都是全麻编译安装手动配置)将nginx和php之间的通信将http转为socket结果报错了错误:An error occurred.Sorry, the page you are looking for is currently unavailable.Please try again late...原创 2019-06-14 10:48:02 · 629 阅读 · 0 评论 -
php 文件内大小单位转换
class unit { private static $units = [ '0' => 'B', '1' => 'KB', '2' => 'MB', '3' => 'GB', '4' => 'TB', '5' => 'PB' ]; //put your code here原创 2018-01-24 11:23:41 · 578 阅读 · 0 评论 -
curl
<?php$virusname = 'test';$md5 = '1234657876543';$url = "http://192.168.10.22/mm/kjm/test.php";$_post_url = $url;$post = 'virusname='.$virusname.'&md5='.$md5;$curl = curl_ini...原创 2018-01-05 10:01:11 · 341 阅读 · 0 评论 -
PHP+redis(转载整两篇博客,很不错很基础)
/*1.Connection*/$redis = new Redis();$redis->connect('127.0.0.1',6379,1);//短链接,本地host,端口为6379,超过1秒放弃链接$redis->open('127.0.0.1',6379,1);//短链接(同上)$redis->pconnect('127.0.0.1',6379,1);/...转载 2017-11-21 14:32:55 · 2111 阅读 · 0 评论 -
php curl 接口请求
phpcurl 接口调用转载 2017-11-13 11:43:21 · 459 阅读 · 0 评论 -
不使用内置函数实现sterev (php)
<?phpfunction str_rev($str){ $return_str = ''; for($i=0;true;$i++) { if(isset($str[$i])){ $return_str = $str[$i].$retrurn_str; }else{ ...原创 2017-11-13 12:34:48 · 333 阅读 · 0 评论 -
回文数字提取(PHP)
从随机字符串中提取回文数据 例如123321原创 2017-11-13 11:53:40 · 486 阅读 · 0 评论 -
php实现多进程、多线程
http://www.cnblogs.com/binghuo000/p/6401123.html转载 2017-10-25 16:10:55 · 2328 阅读 · 0 评论 -
CentOS 7 PHP-redis扩展安装
1、使用wget下载redis压缩包wget https://github.com/phpredis/phpredis/archive/develop.zip2、解压unzip develop.zip3、进入解压后的文件夹生成configurecd develop && phpize4、使用configure./configure --with-php-...原创 2019-03-11 10:09:59 · 287 阅读 · 0 评论 -
phpize 编译扩展出现 Cannot find autoconf
phpize现象Configuring for:PHP Api Version: 20052335Zend Module Api No: 20170755Zend Extension Api No: 253185219Cannot find autoconf. Please check your autoconf installation and th...原创 2019-03-11 10:24:40 · 968 阅读 · 0 评论 -
deepin/ubuntu apt-get快速安装的apache、php7.2和nginx和php7.2
下面是在国产linux deepin里面测试的,下面是history,下面是先安装apache和php7.2 然后有卸载安装nginx和php7.2 ,第一次php安装是以apache模块的方式安装,所以安装完成没有php-fpm 209 apt list | grep libapache2-mod-php* 211 apt list | grep libapache2-mod-ph...原创 2019-05-05 19:11:53 · 3153 阅读 · 0 评论 -
centos7 开源Docker Web PHP
又一次搭建这开源的简单的docker管理界面,PHP写的,很简单,只需要搭安装nginx,php配置好就行,下面这就是简单界面环境:centos7php:php7.2nginx:1.***以下是一些history的过程命令,看到命令就知道是什么意思了,几乎不用解释,nginx和php安装省略1.下载web代码yum install gitgit clone http...原创 2019-04-18 16:23:25 · 242 阅读 · 0 评论 -
centos7 在线快速安装php7.2以及各种扩展
1.今天翻到一年前的笔记,觉得小伙伴用得着,特别是对linux不熟悉的人对于php扩展的安装很是偷痛,不管是编译安装,pecl安装,方式很多但还是其他方式都可能遇到问题,下面是我整理的最简单的方式,粗鲁暴力php在线安装以及扩展一步到位,此方式方法不支持源码编译安装,我也懒得整理了,不讲思路只体现大概过程rpm -Uvh https://mirror.webtatic.com/yum/e...原创 2019-04-17 17:29:47 · 2349 阅读 · 0 评论 -
PHP扩展编写流程简述(LINUX)
心血来潮整理一下php的扩展开发步骤,最简单的,几乎不写什么代码1、准备条件:LINUX环境(centos7.5),下载PHP源码(我这是7.2的,如果编译安装过就直接进入编译安装的源码目录下操作记性,不必重新再来下载解压),其他的就不管了 ,需要什么依赖自己装什么2、进入源码目录下的ext目录,你会看到下面标出来的这个文件,ext_skel_win32.php和ext_skel,wind...原创 2019-04-08 13:40:33 · 429 阅读 · 0 评论 -
编译php7 并配置php-fpm等
configure 之前步骤省略我是安装到/usr/local/php目录下 ,其他参数根据自身需求各自参加,1../configure --prefix=/usr/local/php \--enable-sockets=shared \--enable-fpm \--with-pdo-mysql=shared,mysqlnd \2.make 编译没报错就接着安装 mak...原创 2019-03-26 18:50:26 · 1225 阅读 · 0 评论 -
phpize 缺少autoconf
[root@localhost memcached-3.1.3]# phpizeConfiguring for:PHP Api Version: 20170718Zend Module Api No: 20170718Zend Extension Api No: 320170718Cannot find autoconf. Please check you...原创 2019-03-29 17:21:44 · 121 阅读 · 0 评论 -
PHP操作MongoDB(增删改查)[转载]
PHP操作MongoDB(增删改查)MongoDB的PHP驱动提供了一些核心类来操作MongoDB,总的来说MongoDB命令行中有的功能,它都可以实现,而且参数的格式基本相似。PHP7以前的版本和PHP7之后的版本对MongoDB的操作有所不同,本文主要以PHP7以前版本为例讲解PHP对MongoDB的各种操作,最后再简单说明一下PHP7以后版本对MongoDB的操作。一、数据插入/...原创 2019-03-11 17:25:20 · 432 阅读 · 0 评论 -
获取ip地址
<?phpclass getIp(){ function ClientIp(){ $cIP= getenv($_SERVER['REMOTE_ADDR']); $cIP1 = getenv($_SERVER['HTTP_X_FORWORD_FOR']); $cIP2 = getenv($_SERVER['HTTP_CLIENT_IP...翻译 2019-03-11 11:44:23 · 200 阅读 · 0 评论 -
php oauth2 微信授权登录
<?php /* 返回数据 md5(uniqid(rand(), TRUE)) openid 用户的唯一标识 nickname 用户昵称 sex 用户的性别,值为1时是男性,值为2时是女性,值为0时是未知 province 用户个人资料填写的省份 city 普通用户个人资料填写的城市 count...原创 2017-10-22 22:43:20 · 920 阅读 · 0 评论