composer是php5.3以上 的一个依赖管理工具。简单来说就是你在composer里面可以找到各种优秀的第三方扩展。可以丰富自己的项目节省开发时间。
首先要在你本地win电脑安装composer
安装成功后用命令窗口去安装打开目录执行: echo @php “%~dp0composer.phar” %*>composer.bat
关闭命令窗口重新打开 执行 : composer 结果如图
最新文章
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
最近偶然发现php中if有个自动处理比较的参数
例如
- $a=’adasds’; if($a==0){ echo “GGGG”; }else{ echo “KKKK”; } 结果输出 GGGG 这是if判断$a时会检测字符串中最开始有误数字,无数字就返回0 所以返回 GGGG
- $a=’55adasds’; if($a==55){ echo “GGGG”; }else{ echo “KKKK”; } 结果 GGGG if判断会检测$a中开头是否有数字,有数字就返回数字,所以结果 GGGG
- $a=’ad55asds’;或$a=’adasds55’; if($a==55){ echo “GGGG”; }else{ echo “KKKK”; } 结果 KKKK 说明if判断时检测$a不会检测中间和最后面是否有数字,且结果直接返回0; 综上示例 if判断时如果定义变量是整型就不会出现此问题,如果是字符串就要考虑示例1,2的存在。
Recently I happened to discover that PHP’s if has an automatically handled parameter for comparisons
For example
- $a=’adasds’; if($a==0){ echo “GGGG”; }else{ echo “KKKK”; } The result is GGGG. This is because when if evaluates $a it checks whether there is a number at the very start of the string; if there is no number it returns 0, so the result is GGGG
- $a=’55adasds’; if($a==55){ echo “GGGG”; }else{ echo “KKKK”; } The result is GGGG. The if comparison checks whether there is a number at the beginning of $a; if there is a number it returns that number, so the result is GGGG
- $a=’ad55asds’; or $a=’adasds55’; if($a==55){ echo “GGGG”; }else{ echo “KKKK”; } The result is KKKK, which shows that when if evaluates $a it does not check whether there is a number in the middle or at the end, and the result simply returns 0; In summary, with if comparisons, if the variable you define is an integer this problem won’t come up, but if it is a string you have to take the situations in examples 1 and 2 into account.