verdor
parent::__construct()
。<?php $msg1='Hello '; $msg2='world'; $example = function () use ($msg1, &$msg2) { echo $msg1.$msg2."\n"; }; $example();// "Hello world" $msg1='nohello'; $msg2='whatever'; $example();// "Hello whatever"
php://
IO 流:official manual, php://stdin
, php://stderr
, php://stderr
, php://input
, php://output
, php://temp
等等.foreach
循环时想修改内容时需要加引用 foreach($arr as &$value)
, 但是! 加了这个引用就要额外注意很多点, 详见php.net. 比如数组本身必须有引用, 比如循环结束要 unset($value)
. 真别扭!php7.0-mbstring
, php7.0-xml
等包# 安装 php5-cli sudo apt-get install php5-cli # 安装 php5-fpm sudo apt-get install php5-fpm
location ~ \.php { fastcgi_split_path_info ^(.+\.php)(/.+)$; # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini ## With php5-cgi alone: # fastcgi_pass 127.0.0.1:9000; # With php5-fpm: fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; }