随笔分类 - PHP
php常用函数
摘要:最近服务器经常发现php-fpm进程cpu总数时不时就100%,提高cpu核数也还是一样 废话不多说,直接说解决方案: 一、先说说php-fpm三种子进程的管理方式pm = static 静态,始终保持一个固定数量的子进程,这个数由(pm.max_children)定义,这种方式很不灵活,也通常不是
阅读全文
摘要:function buildTree(array $flat, $pidKey = 'pid', $idKey = 'id', $childrenKey = 'children') { $grouped = []; foreach ($flat as $sub) { $grouped[$sub[$p
阅读全文
摘要:1、字符串键名相同时,array_merge()后边值覆盖前面的值,+是前盖后; 2、数值键名相同时,array_merge()不会覆盖,+是前盖后; eg:字符串 $arr1 = array('a'=>'PHP'); $arr2 = array('a'=>'PYTHON'); print_r(ar
阅读全文
摘要:public function getCurlApis() { $url = 'www.xxx.com'; //$headers = array('access_token:'.$token); $curl = curl_init(); curl_setopt($curl, CURLOPT_URL,
阅读全文
摘要:方法一: 输出“登录成功,正在跳转....”的提示,并在3秒之后跳转到百度首页.<?php echo "登录成功,正在跳转...."; header("refresh:3;url=http://www.baidu.com"); ?> 方法二:使用php的sleep()函数<?php print("登
阅读全文