Jun262020
jquery实现投票占比特效
jquery实现投票占比特效,具体代码如下:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>jquery实现投票占比特效</title>
    <style type="text/css">
        #ProgressBarBox{vertical-align: middle;}
        #ProgressBarBox div {float:left;}
        #processBar{width:6px;height:10px; backgrou...阅读全文
抢沙发
Jun262020
jQuery实现的简单百分比进度条效果示例
jQuery实现的简单百分比进度条效果示例,具体代码如下:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>jQuery实现的简单百分比进度条效果示例</title>
</head>
<script type="text/javascript" src="http://www.phpernote.com/js/jquery.min.js"></script>
<script type="text/javascript"...阅读全文
Jun192020
解决Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future:
今天再点新的服务器上链接数据库时报错:Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in,找了一下原因,总结如下
    新的服务器直接上5.5,但是程序出现如下错误:Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in,...阅读全文
Jun192020
Jun092020
二维数组按指定的键值排序
关于这个问题,已经有更好的解决方案了,请参考:
php二维数组按某个字段排序
不过下面的代码仍可以供参考:
原创:将二维数组按指定的键值排序。
/*
function:二维数组按指定的键值排序
author:www.phpernote.com
*/
function array_sort($array,$keys,$type='asc'){
	if(!is_array($array)||empty($array)||!in_array(strtolower($type),array('asc','desc'))) return '';
	$keysvalue=...阅读全文
Jun082020
php生成器yield使用总结
一般我们在迭代一组数据的时候,需要创建一个数据,如果数组很大,则会消耗很大性能,甚至造成内存不足抛出error
比如:
//Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 32 bytes) in D:\php\test\index.php on line 5
range(1, 100000000);
PHP5.5引入了迭代生成器的概念,迭代的概念早就在PHP有了,但是迭代生成器是PHP的一个新特性,这跟python3...阅读全文
May312020
http站点使用php或nginx配置301方式跳转到https
首先说一下http和https:
http定义了客户端(浏览器)与服务器之间的通信规则,端口号是80,大部分客户端指的是我们平时上网的浏览器,当然有很多中断例如手机APP、嵌入式软件也可能采用http和服务器通信,这种协议在传输的时候是明文的,也就是在通信过程中传输的数据在线路的每个节点(例如网关,路由器)都可以被劫持到,所以安全性较低。而https即http下加入SSL层加密,端口号是443,...阅读全文
May302020
linux tar打包压缩排除某个目录或文件
用tar打包时想剔除打包目录中的某个子目录或文件:
比如你想打包/home这个目录,但是/home/www.phpernote.com/目录,/home/.git目录和/home/www/test.php文件你都不想打包,方法是:
tar -zcvf home.tar.gz /home --exclude=/home/www.phpernote.com --exclude=/home/.git --exclude=/home/www/test.php
命令格式如下:
tar -zcvf xxx.tar.gz   要打包的目录 –exclude=dir1 –...阅读全文
May262020
php中根据指定日期获取所在天,周,月,年的开始日期与结束日期
先写出指定日期的时间格式和时间戳格式,下面要用到:
$str_day = '2022-10-17'; //时间格式$time_day = $date_time = date("Y-m-d", $str_time);  //时间戳格式
指定日期所在天的时间:
//精确到 年-月-日
$start_time = time_day ;//开始时间(2020-04-17)
$end_time = date("Y-m-d", strtotime("+1 day", $str_time));//结束时间(第二天的开始时间2020-04-18)
//精确到 年-月-日 时:分:...阅读全文
May232020
php输出json数据方法
php输出json数据方法。
/**
 * 输出json
 * @param string $msg 提示信息
 * @param int $errcode 错误代码
 * @param array $append_array 附加信息
 */
function echoJson($msg = '操作成功', $errcode = 0, $append_array = []) {
    header('content-type:application/json;charset=utf-8');
    $result = ['errcode' => $errcode, 'msg' => $msg];
    $append_array &&...阅读全文
 
        
         
 
 
 
 
 
 
 
