Php 开发笔记相关
Summary: Author: 张亚飞 | Read Time: 3 minute read | Published: 2016-03-14
Filed under
—
Categories:
Linux
—
Tags:
Note,
Php 开发笔记相关
PHP 抢房
- Rolling cURL:PHP并发最佳实践
- php-fpm.conf重要参数详解
- php-fpm 与 Nginx优化总结
- PHP-FPM的pm.max_children 配置值怎么计算?
- PHP的curl造成性能瓶颈,如何优化?
- curl内部调用性能急剧下降
PHP 僵尸进程
- 杀掉僵尸进程
kill -HUP `ps -A -ostat,ppid | grep -e '^[Zz]' | awk '{print $2}'`
参考
PHP 自动加载
几种常用的 header 声明
header — 发送原生 HTTP 头
* 第一种 -- 标准写法
header('Content-type: application/json');
* 另一种 -- 旧版本,兼容 IE 6
header('Content-type: text/json');
header('Location: http://www.example.com/');
header('WWW-Authenticate: Negotiate');
header('WWW-Authenticate: NTLM', false)
- 自动下载文件
// We'll be outputting a PDF
header('Content-type: application/pdf');
// It will be called downloaded.pdf
header('Content-Disposition: attachment; filename="downloaded.pdf"');
// The PDF source is in original.pdf
readfile('original.pdf');
- 输出
utf-8
header('Content-Type: text/html; charset=utf-8');
header('Content-Type: charset=utf-8'); # 短写法
php 对象数组相互转换
- Converting an array/stdClass -> stdClass
$stdClass = json_decode(json_encode($booking));
- Converting an array/stdClass -> array
$array = json_decode(json_encode($booking), true);
PHP 数组注意的地方:
- 下载 PHP 文档源码:
$ wget https://www.php.net/distributions/manual/php_manual_zh.tar.gz
- 过滤需要注意的数组函数:
Downloads/php-chunked-xhtml$ grep -r "注释" function.array*
function.array-change-key-case.html: <h3 class="title">注释</h3>
function.array-diff-assoc.html: <h3 class="title">注释</h3>
function.array-diff-key.html: <h3 class="title">注释</h3>
function.array-diff-uassoc.html: <h3 class="title">注释</h3>
function.array-diff-ukey.html: <h3 class="title">注释</h3>
function.array-diff.html: <h3 class="title">注释</h3>
function.array-fill.html: <h3 class="title">注释</h3>
function.array-filter.html: <h3 class="title">注释</h3>
function.array-intersect.html: <h3 class="title">注释</h3>
function.array-key-exists.html: <h3 class="title">注释</h3>
function.array-key-first.html: <h3 class="title">注释</h3>
function.array-udiff-uassoc.html: <h3 class="title">注释</h3>
function.array-udiff.html: <h3 class="title">注释</h3>
function.array-unique.html: <h3 class="title">注释</h3>
function.array.html: <h3 class="title">注释</h3>
PHP 密码HASH加密方案
Password Hashing
- password_hash: 对密码进行hash,得到散列值
- password_verify: 对输入的密码进行校验,判断是否正确
- password_get_info: 获取生成的hash值的信息,包括加密算法,相关加密参数等
- password_needs_rehash: 检查一个hash值是否是使用特定算法及选项创建的
$PtInfo = explode('/', pathinfo($_SERVER["SCRIPT_FILENAME"])['dirname']);
//error_log(print_r($PtInfo, TRUE), 3, '/data/home/coam/Home/LoginWindows/Logs/ee.log');
//error_log($PtInfo[5], 3, '/data/home/coam/Home/LoginWindows/Logs/ee.log');
// $min_serveOptions['minApp']['groups'] = (require '/data/home/coam/CoamServer/' . $PtInfo[5] . '/public/MinifyGroupsConfig.php');
// $min_serveOptions['minApp']['groups'] = (require BASE_COAM_SERVER_DIR ."/". $PtInfo[5] . '/public/MinifyGroupsConfig.php');
$min_serveOptions['minApp']['groups'] = (require dirname(__DIR__) ."/../../../../". $PtInfo[5] . '/public/MinifyGroupsConfig.php');
PHP读取软件接ln 的相对父路径问题
PHP读取软连接下的PHP程序使用 DIR 获取的相对路径,获取的父级目录是源文件的父级目录,若想获取软连接的父级目录,应使用 $_SERVER[“SCRIPT_FILENAME”]来获取当前脚本文件绝句路径再拼接
关于 CGI, FastCGI, PHP-FPM, SPAWN-FCGI, Nginx 它们之间的关系
- CGI, FastCGI, PHP-FPM, SPAWN-FCGI, Nginx 它们之间的关系
- php fpm和fast-CGI有啥关系?而且还有一个疑问,就是PHP以CGI方式运行,请问以CGI方式运行到底是啥意思??
Comments