随笔分类 -  PHP

1 2 下一页
LaravelORM 中的 withSum , withAvg, withMax,withMin 的实现
摘要:Orm::withCount(['relation as relation_sum' =>function($query){ $query->select(DB::raw("sum(amount) as relationsum")); }]) 阅读全文
posted @ 2021-11-03 10:25 jzfan
unix 更新 php 版本
摘要:卸载旧的版本 sudo apt-get autoremove php7* sudo find /etc -name "*php*" |xargs sudo rm -rf 更新源 sudo add-apt-repository ppa:ondrej/php sudo apt-get update 安装 阅读全文
posted @ 2020-11-05 17:51 jzfan
PHP 半小时间隔时间段
摘要:1. 拆分 $start = '08:30'; $end = '20:00'; $arr = []; for ($i = strtotime($start); $i <= strtotime($end); $i = $i + 60 * 30) { $arr[] = date("H:i", $i); 阅读全文
posted @ 2020-03-11 17:00 jzfan
无限极分类
摘要:class CategoryController extends Controller { public function index() { $rootCats = Category::where('parent_id', null)->get(); return $this->tree($rootCats); } priv... 阅读全文
posted @ 2019-10-04 21:55 jzfan
upgrade php7.0 to php7.1 in ubuntu 16
摘要:php -v sudo add-apt-repository ppa:ondrej/php sudo apt-get update apt-cache search php7.1 (optional) sudo apt-get remove php7.0 sudo apt-get --purge a 阅读全文
posted @ 2018-02-17 02:14 jzfan
ubuntu apt-get install php
摘要:sudo add-apt-repository ppa:ondrej/php apt-get upgrade apt-get update 阅读全文
posted @ 2016-08-05 23:03 jzfan
truncate
摘要:css php blade @truncate($card->title, 20) 阅读全文
posted @ 2016-06-16 05:02 jzfan
reflection
摘要:function method 阅读全文
posted @ 2016-06-10 16:28 jzfan
add active class
摘要:根据URI添加菜单的active css class 阅读全文
posted @ 2016-04-13 08:44 jzfan
时间函数 date strtotime
摘要:date_default_timezone_set('Asia/Shanghai');echo strtotime('Today');echo strtotime(date('Y-m-d')); 获取明天凌晨的时间戳 代码:echo strtotime(date('Y-m-d',strtotime('+1 day'))); 附上测试代码: echo strtotime('2012-1... 阅读全文
posted @ 2016-03-10 14:18 jzfan
php7安装
摘要:apt-get install 阅读全文
posted @ 2016-02-20 11:01 jzfan
img base64
摘要:" /> 阅读全文
posted @ 2015-11-24 16:51 jzfan
xml提取
摘要:$url = 'http://221.232.141.108/hsdcw/news.xml';$opts = array( 'http'=>array( 'method'=>"GET", 'timeout'=>10, ) );$conte... 阅读全文
posted @ 2015-11-19 15:12 jzfan
PHP iconv()函数转字符编码的问题(转)
摘要:PHP iconv()函数转字符编码的问题(转)载自:http://www.nowamagic.net/php/php_FunctionIconv.php在php函数库有一个函数:iconv(),iconv函数库能够完成各种字符集间的转换,是php编程中不可缺少的基础函数库。最近在做一个小偷程序,需... 阅读全文
posted @ 2015-10-04 11:22 jzfan
获取网页中图片
摘要:]*>/i', $text, $match); //打印出match print_r($match); 阅读全文
posted @ 2015-09-21 22:36 jzfan
遍历一个文件夹下的所有文件和子文件夹
摘要:function listDir($dir = '.'){ if ($handle = opendir($dir)) { while (false !== ($file = readdir($handle))) { if($file == '.' || $f... 阅读全文
posted @ 2015-09-21 22:21 jzfan
URL解析
摘要:取脚本扩展名 #测试网址: http://localhost/blog/testurl.php?id=5//获取域名或主机地址 echo $_SERVER['HTTP_HOST'].""; #localhost//获取网页地址 echo $_SERVER['PHP_SELF'].""... 阅读全文
posted @ 2015-09-21 22:13 jzfan
相对路径
摘要:写一个函数,算出两个文件的相对路径 阅读全文
posted @ 2015-09-21 22:12 jzfan
无极分类之子孙树、父辈树
摘要:无极分类之子孙树、父辈树$value) { if($value['father_id'] == $id) { $value['depth'] = $depth; $tree[] = $value;... 阅读全文
posted @ 2015-08-29 23:47 jzfan
php安全配置分享
摘要:以往的lamp网站向着lnmp发展, 笔者工作环境使用lnmp多年, 在这里很高兴和大家分享一下多年的lnmp网站的php安全配置,至于lamp安全后续与大家分享,其实内容上八成相同,这边着重讲php安全配置,看内容.1. 使用open_basedir限制虚拟主机跨目录访问?[HOST=www.tt... 阅读全文
posted @ 2015-08-04 10:00 jzfan

1 2 下一页