随笔分类 -  PHP

摘要:PHP supports first-class functions, meaning that a function can be assigned to a variable. Both user-defined and built-in functions can be referenced 阅读全文
posted @ 2019-05-05 16:20 Victor!!!! 阅读(116) 评论(0) 推荐(0)
摘要:POST HTTP.POST can be used when the client is sending data to the server and the server will decide the URI for the newly created resource. The POST m 阅读全文
posted @ 2019-05-05 14:40 Victor!!!! 阅读(129) 评论(0) 推荐(0)
摘要:标量类型声明: 增加了对返回类型声明的支持。 <?php function arraySum(array ...$arrays): array { return array_map(function(array $array): int { return array_sum($array); }, 阅读全文
posted @ 2019-05-05 14:39 Victor!!!!
摘要:定义超全局变量: <?php $room = 20; function show() : void { $room = $GLOBALS['room']; echo $room; } ?> 这里使用了$GLOBALS这个包含全局变量的数组 Final Key word: 如果父类中的方法被声明为 f 阅读全文
posted @ 2019-05-05 14:39 Victor!!!!
摘要:Zend OPcache: Nginx 把HTTP请求转发给PHP-FPM, PHP-FPM再把请求交给某个PHP子进程处理。PHP进程找到相应的PHP脚本后,读取脚本,把PHP脚本编译成操作码(或字节码)格式,然后执行编译得到的操作码,生成响应。最后把HTTP响应发送给nginx,nginx再把响 阅读全文
posted @ 2019-05-05 13:27 Victor!!!! 阅读(129) 评论(0) 推荐(0)
摘要:过滤输入: 是指转义或者删除不安全的字符。在数据到达应用的储存层(mysql or redis)之前,一定要过滤输入的数据。 过滤HTML数据: 使用htmlentities()函数。默认情况下,这个函数不会转义单引号。而且也检测不出输入字符串的字符集。htmlentities()函数的正确使用方式 阅读全文
posted @ 2019-05-05 13:26 Victor!!!!
摘要:Zend OPcache 字节码缓存:PHP是解释型语言,PHP解释器执行PHP脚本时会解析PHP脚本代码,把PHP代码编译成一系列Zend操作码,然后执行字节码。每次请求PHP文件都这样,会消耗很多资源,如果每次HTTP请求PHP都必须不断解析,编译和执行PHP脚本,消耗的资源更多。 字节码缓存能 阅读全文
posted @ 2019-05-05 13:06 Victor!!!!
摘要:安装: 1. 下载Composer安装脚本: curl -sS https://getcomposer.org/installer | php 2. 重命名以及移动到/usr/local/bin/composer: sudo mv composer.phar /usr/local/bin/compo 阅读全文
posted @ 2019-05-05 12:58 Victor!!!!
摘要:命名空间: 命名空间很重要,因为代码放在沙盒中,可以和其他开发者编写的代码一起使用。这是现代PHP组件生态系统的基础。组件和框架的作者编写了大量的代码,供众多PHP开发者使用,这些作者不可能知道或者控制别人在使用自己的代码时还能使用了什么其他类、接口、函数或者常量。在你自己的私人项目中也会遇到这种问 阅读全文
posted @ 2019-05-05 12:52 Victor!!!!