差别
这里会显示出您选择的修订版和当前版本之间的差别。
两侧同时换到之前的修订记录 前一修订版 后一修订版 | 前一修订版 | ||
public:it:php [2015/05/19 10:27] – oakfire | public:it:php [2019/03/26 17:38] (当前版本) – [Others] oakfire | ||
---|---|---|---|
行 3: | 行 3: | ||
* [[http:// | * [[http:// | ||
* [[http:// | * [[http:// | ||
+ | ===== Composer ===== | ||
+ | * Official site: | ||
+ | * composer 项目安装目录'' | ||
+ | |||
+ | ===== Syntax ===== | ||
+ | ==== 代码组织 ==== | ||
+ | * **include**: | ||
+ | * **require** 和 include 几乎完全一样,除了处理失败的方式不同之外 | ||
+ | |||
+ | ==== 面向对象(OO) ==== | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * 构造与析构( __construct, | ||
+ | * 如果子类中定义了构造函数则不会隐式调用其父类的构造函数。 | ||
+ | * 要执行父类的构造函数,需要在子类的构造函数中调用'' | ||
+ | * 如果子类没有定义构造函数则会如同一个普通的类方法一样从父类继承(假如没有被定义为 private 的话)。 | ||
+ | ==== 函数式 ==== | ||
+ | * 匿名函数(Anonymous functions); 没有自动继承父作用域变量, | ||
+ | <?php | ||
+ | $msg1=' | ||
+ | $msg2=' | ||
+ | $example = function () use ($msg1, &$msg2) { | ||
+ | echo $msg1.$msg2." | ||
+ | }; | ||
+ | $example();// | ||
+ | $msg1=' | ||
+ | $msg2=' | ||
+ | $example();// | ||
+ | </ | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | ==== Notes ==== | ||
+ | * <wrap em> | ||
+ | * '' | ||
+ | * '' | ||
+ | ===== Others ===== | ||
+ | * Ubuntu 16.04 的 php7 包,默认没有 mbstring dom 等模块支持,需要安装 '' | ||
+ | * Ubuntu 14.04 安装 php 环境: <code bash> | ||
+ | # 安装 php5-cli | ||
+ | sudo apt-get install php5-cli | ||
+ | # 安装 php5-fpm | ||
+ | sudo apt-get install php5-fpm | ||
+ | </ | ||
+ | * nginx 中关于 php 的适用 pathinfo 模式的配置:< | ||
+ | location ~ \.php { | ||
+ | fastcgi_split_path_info ^(.+\.php)(/ | ||
+ | # NOTE: You should have " | ||
+ | |||
+ | ## With php5-cgi alone: | ||
+ | # fastcgi_pass 127.0.0.1: | ||
+ | # With php5-fpm: | ||
+ | fastcgi_pass unix:/ | ||
+ | fastcgi_index index.php; | ||
+ | include fastcgi_params; | ||
+ | fastcgi_param PATH_INFO $fastcgi_path_info; | ||
+ | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
+ | } | ||
+ | |||
+ | </ | ||
+ | ===== Tips ===== | ||
+ | * 输出对象信息:< | ||
+ | error_log(print_r($php_object, | ||
+ | </ | ||