ElasticSearch安装
Docker镜像拉取
1 | docker search elasticsearch |
本地创建es挂载目录
1 | mkdir /data/elasticsearch/data |
设计模式在php开发中用途还是非常多,能够使用设计模式并准确选择设计模式将事半功倍的提高开发效率,而且也能提高代码可读性和提升代码解耦度,非常方便以后我们在迭代功能的时候的扩展与重构,不至于看到自己以前写的代码无所适从。
单例模式:即一个类只被实例化一次,当其他人对其再次实例化时,返回第一次实例化的对象,可以避免大量的new
操作,减少资源的消耗,典型应用于数据库类的实例化。
特点:三私一公 (私有静态属性instance,私有构造方法,私有克隆方法,公有化静态方法getInstance)
1 | <?php |
官网下载地址:https://www.elastic.co/cn/downloads/
找到自己系统对应的版本,本文以Linux系统为例,只阐述单机版安装
1 | # 添加新用户 |
本文章以php7.1.31和php7.3.9版本为例进行安装
1 | yum install -y gcc gcc-c++ make zlib zlib-devel pcre pcre-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers |
1 | cd /usr/local |
1 | tar -zxvf php-7.1.31.tar.gz |
先看下效果,个人比较喜欢
layer是一款近年来备受青睐的web弹层组件,官网地址是:http://layer.layui.com/
可以从官网上下载最新版本。
当layer以iframe层的方式弹出新的窗口(子页面),如何在子页面中访问父页面的元素和函数。
1 | var parentId=parent.$("#id").val();//访问父页面元素值 |
Slim does not have a view layer like traditional MVC frameworks. Instead, Slim’s “view” is the HTTP response. Each Slim application route is responsible for preparing and returning an appropriate PSR-7 response object.
That being said, the Slim project provides the Twig-View and PHP-View components to help you render templates to a PSR7 Response object.
The Twig-View PHP component helps you render Twig templates in your application. This component is available on Packagist, and it’s easy to install with Composer like this: