string: Type that maps a SQL VARCHAR to a PHP string.
integer: Type that maps a SQL INT to a PHP integer.
smallint: Type that maps a database SMALLINT to a PHP integer.
bigint: Type that maps a database BIGINT to a PHP string.
boolean: Type that maps a SQL boolean or equivalent (TINYINT) to a PHP boolean.
decimal: Type that maps a SQL DECIMAL to a PHP string.
date: Type that maps a SQL DATETIME to a PHP DateTime object.
time: Type that maps a SQL TIME to a PHP DateTime object.
datetime: Type that maps a SQL DATETIME/TIMESTAMP to a PHP DateTime object.
datetimetz: Type that maps a SQL DATETIME/TIMESTAMP to a PHP DateTime object with timezone.
text: Type that maps a SQL CLOB to a PHP string.
object: Type that maps a SQL CLOB to a PHP object using serialize() and unserialize()
array: Type that maps a SQL CLOB to a PHP array using serialize() and unserialize()
simple_array: Type that maps a SQL CLOB to a PHP array using implode() and explode(), with a comma as delimiter. IMPORTANT Only use this type if you are sure that your values cannot contain a ”,”.
json_array: Type that maps a SQL CLOB to a PHP array using json_encode() and json_decode()
float: Type that maps a SQL Float (Double Precision) to a PHP double. IMPORTANT: Works only with locale settings that use decimal points as separator.
guid: Type that maps a database GUID/UUID to a PHP string. Defaults to varchar but uses a specific type if the platform supports it.
blob: Type that maps a SQL BLOB to a PHP resource stream
常用正则表达式
发表于
匹配汉字
/^[\x{4e00}-\x{9fa5}].+$/u
用户名
/^[a-z0-9_-]{3,16}$/
密码
/^[a-z0-9_-]{6,18}$/
Git中的AutoCRLF与SafeCRLF
发表于
一、AutoCRLF
提交时转换为LF,检出时转换为CRLF1
git config --global core.autocrlf true
提交时转换为LF,检出时不转换1
git config --global core.autocrlf input
提交检出均不转换1
git config --global core.autocrlf false
二、SafeCRLF
拒绝提交包含混合换行符的文件1
2
3
4
5
6git config --global core.safecrlf true
```
允许提交包含混合换行符的文件
```bash
git config --global core.safecrlf false
提交包含混合换行符的文件时给出警告1
git config --global core.safecrlf warn
避免重复Ajax提交
发表于
之前在做网站的时候,采用如下代码进行ajax提交,在访客点击的时候请求如果没有及时得到服务器的响应,会尝试反复点击造成重复提交
1 | $(function(){ |
为了避免重复提交,将代码改成如下
1 | $(function(){ |
几个面试题
发表于
1、编写一个函数将1,2,3,4,5,6随机放到一个数组,3不能在第三的位置,5和6不能挨着。
1 | <?php |
2、编写一个函数实现 将字符串$str=”asdfasflasdfopafdsa”, 中第一个之出现过一次的字母。
1 | <?php |
3、有两个表,请编写一条sql语句查询出t1-t2时间段间的产品名、销售量总数并按照销售量总数由高到低排序。
1 | CREATE TABLE products ( |
我的解法:
1 | SELECT |