最近公司招聘新员工,面试中有提到会话原理,我懵了一下。 会话原理是什么? 首先解释一下什么是会话。在计算机术语中,会话是指一个终端用户与交互系统进行通讯的过程,比如从输入账户密码进入操作系统到退出操作系统就是一个会话过程。会话较多用于网络上,TCP的三次握手就创建了一个会话,TCP关闭连接就是关闭会话。用平述的语言可以解释为:你拔打你女友的电话号码,你女友接听,然后一翻“亲爱的”,直到任何一方挂掉电话,这个过程就是一个会话。你挑逗一只小狗,它跟你互动,也是会话;它不鸟你,那就不形成会话。 这不是就是服务端与用户端的通信,或者说用户端登录服务端的认证。 她可以使服务器间的通信,浏览器与网站的通信…… 可以用传统的cookie、session机制实现。也可以用令牌认证实现。这其中包含:创建会话 、认证会话 、获取会话信息、会话时长限制、销毁会话。 通俗的就是一个用户登录到一网站,并浏览网站数据,然后离开的过程。 其实,就是登录认证服务。
最新文章
Recently our company was hiring new employees, and the principle of sessions came up during an interview — I blanked for a moment. What exactly is the principle of sessions? First, let me explain what a session is. In computer terminology, a session refers to the process of communication between an end user and an interactive system; for example, going from typing in an account and password to enter an operating system all the way to logging out of the operating system is one session. Sessions are more commonly used on networks: TCP’s three-way handshake creates a session, and closing a TCP connection closes the session. In plain language you could explain it like this: you dial your girlfriend’s phone number, your girlfriend answers, and then there’s a round of “dear…” until either side hangs up — that whole process is a session. You tease a puppy and it interacts with you, and that is also a session; if it ignores you, then no session is formed. Isn’t this just communication between the server and the client, or in other words the client authenticating by logging into the server? It can enable communication between servers, communication between a browser and a website… It can be implemented with the traditional cookie and session mechanisms. It can also be implemented with token authentication. This includes: creating a session, authenticating a session, retrieving session information, session duration limits, and destroying a session. In everyday terms, it is the process of a user logging into a website, browsing the website’s data, and then leaving. In fact, it is just a login authentication service.
Composer is a dependency management tool for PHP 5.3 and above. Simply put, in Composer you can find all kinds of excellent third-party extensions. It can enrich your project and save development time.
First you need to install Composer on your local Windows machine.
Once the installation succeeds, use a command window to install it — open the directory and run: echo @php “%~dp0composer.phar” %*>composer.bat
Close the command window and reopen it, then run: composer. The result is shown in the figure.
夜出鹏城宿羊南, 千里粤豫一日还。 九朝帝王今何在, 洛水小巷今荣繁。 写于2017年春节归途。
By night I leave Pengcheng, to lodge south of Yang; a thousand li from Yue to Yu in a single day. Where now are the emperors of nine dynasties? The lanes by the Luo River thrive today. Written on the road home for the 2017 Spring Festival.
最近需要套个模板,当然模板不需去购买。那就抓取一个,百度一下发现wget是个不错的用法。
wget -r -p -np -k https://erik.xyz 就可抓取整个站点模板到本地。
然后打包压缩,拷贝到win电脑就可以修修改改。
顺便查查wget使用方法
-a<日志文件>:在指定的日志文件中记录资料的执行过程;
-A<后缀名>:指定要下载文件的后缀名,多个后缀名之间使用逗号进行分隔;
-b:进行后台的方式运行wget;
Recently I needed to adapt a template, and of course I wasn’t going to buy one. So I’d scrape one instead — a quick search turned up wget as a pretty good way to do it.
wget -r -p -np -k https://erik.xyz and you can scrape the whole site’s template to your local machine.
Then package it up, compress it, copy it to a Windows machine and you can tinker with it as you like.
While I was at it I looked up how to use wget
-a
-A
-b: run wget in the background;
在官方pecl库中只能找到支持5.2版本的sphinx扩展。php7出来好一段时间了,没有sphinx不太科学。根据网友给的提提示,在pecl库下的sphinx页面中,点击[ Browse Source ] 如下图:
In the official pecl repository you can only find a Sphinx extension that supports version 5.2. PHP 7 has been out for quite a while, and having no Sphinx isn’t very reasonable. Following a tip from a fellow netizen, on the sphinx page under the pecl repository, click [ Browse Source ] as shown below:
本文转载自:http://www.scutephp.com/topic-id1325.html 收集整理一些常用的PHP类库, 资源以及技巧. 以便在工作中迅速的查找所需… 
学习资源
php相关的有参考价值的社区,博客,网站,文章,书籍,视频等资源
- PHP网站(PHP Websites)
- PHP The Right Way 一个PHP实践的快速参考指导
- PHP书籍(PHP Books)
- Modern PHP - 作者是PHP 之道的发起人和Slim框架的作者
This article is reposted from: http://www.scutephp.com/topic-id1325.html A collection of commonly used PHP libraries, resources and tips, so you can quickly find what you need at work… 
Learning Resources
Valuable php-related resources for reference: communities, blogs, websites, articles, books, videos and so on
- PHP Websites
- PHP The Right Way A quick reference guide to PHP practices
- PHP Books
- Modern PHP - by the founder of PHP The Right Way and the author of the Slim framework
1 | public function xmlArray($xml){ |
1 | public function xmlArray($xml){ |
- 基本类型
- integer 整型 表示整数
- float 浮点数 双精度值,表示所有实数
- string 字符串 表示字符串
- boolean 布尔值 表示true或false
- array 数组 保存具有相同类型的多个数据项
- object 对象 保存类的实例 特殊类型
- NULL 空 没有被赋值、已经被重置或者被赋值为特殊值NULL的变量就是NULL类型的变量
- resource 资源 特定内置函数(例如数据库函数)将返回resource类型的变量 必须作为参数传递给其他函数
- Basic types
- integer — integer type, represents whole numbers
- float — floating point, double-precision values, represents all real numbers
- string — string type, represents strings
- boolean — boolean, represents true or false
- array — array, holds multiple data items of the same type
- object — object, holds an instance of a class; a special type
- NULL — null, a variable that has not been assigned a value, has been reset, or has been assigned the special value NULL is a variable of the NULL type
- resource — resource, specific built-in functions (for example database functions) return variables of the resource type; they must be passed as arguments to other functions
引用操作符 & 引用操作符主要用在关联赋值中,一个变量赋值给另一个变量的时候,先产生原变量的副本,然后再将副本保存在内存中。
例如: $a=1; $b=$a; echo $b; 结果为 1
如果 $a=2; 则 echo $b; 结果还是 1 。
因为$a的赋值副本依然在内存中,赋值依然是第一个值的副本。 这样就用引用操作符 & ,引用操作符会重置原来的指向地址。
The reference operator & — the reference operator is mainly used in associative assignment. When one variable is assigned to another variable, a copy of the original variable is produced first, and then that copy is saved in memory.
For example: $a=1; $b=$a; echo $b; the result is 1
If $a=2; then echo $b; the result is still 1 .
Because the copy assigned to $a is still in memory, the assignment is still a copy of the first value. So we use the reference operator &, which resets the original address being pointed to.
php用了那么久一些基础东西并不是很了解,今天开始就陆陆续续的学习一下。
php中超级全局变量:
- $GLOBALS 所有全局变量数组
- $_SERVER 服务器环境变量数组
- $_GET get传递给脚本的变量数组
- $_POST post传给脚本的变量数组
- $_COOKIE cookie变量数组
- $_FILES 上传文件相关的变量数组
- $_ENV 环境变量数组
- $_REQUEST 所有输入用户的变量数组(包括$_GET $_POST $_COOKIE不包括$_FILES) $_SESSION 会话变量数组
I’ve used PHP for so long but don’t really understand some of the basics. Starting today I’ll be studying them one by one.
Superglobals in PHP:
- $GLOBALS array of all global variables
- $_SERVER array of server environment variables
- $_GET array of variables passed to the script via get
- $_POST array of variables passed to the script via post
- $_COOKIE array of cookie variables
- $_FILES array of variables related to file uploads
- $_ENV array of environment variables
- $_REQUEST array of all user-input variables (including $_GET $_POST $_COOKIE but not $_FILES) $_SESSION array of session variables