随笔分类 -  PHP

摘要:变量命名规则:1.变量名区分大小写(case-sensitive) 。2.必须字母或下划线开头。变量名可由 字母、数字、下划线组成。看到这里可能,很多人纳闷了~。那为啥$我是变量这样的中文也能做变量名呢? 在PHP里,中文的确是可以做变量名的(能用是能用但千万别项目上用....) 。 因为这里的字母... 阅读全文
posted @ 2014-09-28 15:31 timily 阅读(2527) 评论(0) 推荐(0)
摘要:** For the full copyright and license information, please view the LICENSE* file that was distributed with this source code.*/namespace Symfony\Compon... 阅读全文
posted @ 2014-09-03 12:28 timily 阅读(185) 评论(0) 推荐(0)
摘要:php下載文件是通常使用readfile函數讀取文件進行下載,在遇到大文件下載的時候,往往不太適用,效率不怎麼樣。使用x-sendfile模塊則可以繞過php讀取文件的方式了,直接設置頭部信息就可以,利用服務器將文件發送到客戶端進行下載x-sendfile模塊apache服務器的配置設置xsendf... 阅读全文
posted @ 2014-08-22 16:39 timily 阅读(273) 评论(0) 推荐(0)
摘要:模擬了一下session跨域原理在本機上面做了以下測試http://localhost/test/test.php 在這個頁面裡面設置了session,通過另外一個域名來訪問這個session值,內容如下: 阅读全文
posted @ 2014-08-22 16:10 timily 阅读(262) 评论(0) 推荐(1)
摘要:Permission is hereby granted, free of charge, to any person obtaininga copy of this software and associated documentation files (the"Software"), to de... 阅读全文
posted @ 2014-08-08 15:25 timily 阅读(181) 评论(0) 推荐(0)
摘要:$value) { $obj[$key] = get_object_vars_deep($value); } } return $obj;}/*斐膘砉涴欴腔脤戙: "IN('a','b')";* * @param mix $item_... 阅读全文
posted @ 2014-08-08 15:23 timily 阅读(176) 评论(0) 推荐(0)
摘要:* Victor Stanciu (until v.1.0) * @license http://www.opensource.org/licenses/mit-license.php MIT License * @link Official p... 阅读全文
posted @ 2014-08-08 15:12 timily 阅读(295) 评论(0) 推荐(0)
摘要:load->library('Download');if(!$this->download->->downloadfile($filename)){ echo $this->download->geterrormsg();}*/ class Download{ var $debug=t... 阅读全文
posted @ 2014-08-08 15:08 timily 阅读(251) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2014-08-08 15:06 timily 阅读(305) 评论(0) 推荐(0)
摘要:class DES{ var $key; function DES() { $this->key = md5("EPH e-Textbook"); $this->key = "".$this->key; $this->key = strtoupp... 阅读全文
posted @ 2014-08-08 15:04 timily 阅读(622) 评论(0) 推荐(0)
摘要:对一批文件进行压缩处理,采用system 调用linux 压缩命令进行文件压缩。命令公用代码:function addZip($webdocs, $zipfile, $param, $file){ system("cd $webdocs; tar $param $zipfile \"".$fi... 阅读全文
posted @ 2014-08-08 14:24 timily 阅读(359) 评论(0) 推荐(0)
摘要:$i = 0;$now = '';while ($i >= 0) { if ($i>10) { break; } fseek($file_handle, 0, SEEK_CUR); $now = fgetc($file_handle);//可以自己写个判断fal... 阅读全文
posted @ 2014-07-11 21:46 timily 阅读(260) 评论(0) 推荐(1)
摘要:队列,很简单的一个东西,但往往就是有那么多的麻烦。 比如PHP发送邮件的时候,如果在用户注册,你是注册的时候发送邮件呢,还是注册成功之后发送呢,很显然,大多数时候都是在注册完成之后发送邮件,除非特殊情况,但是怎么让注册之后直接返回结果而不管是否发送了邮件呢。 这里就需要这样一个东西,单独处理一个... 阅读全文
posted @ 2014-07-07 21:34 timily 阅读(918) 评论(0) 推荐(0)
摘要:php: 阅读全文
posted @ 2014-06-23 21:45 timily 阅读(178) 评论(0) 推荐(0)
摘要:file=$file; $this->save='wm'.basename($this->file).'.jpg'; // new file to save watermarked image as $this->im=$this->open_img($this->file); ... 阅读全文
posted @ 2014-06-19 22:59 timily 阅读(164) 评论(0) 推荐(0)
摘要:flock在官方文档里的解释是:flock() 允许你执行一个简单的可以在任何平台中使用的读取/写入模型(包括大部分的 Unix 派生版和甚至是Windows)。如果锁定会堵塞的话(EWOULDBLOCK 错误码情况下),请将可选的第三个参数设置为 TRUE。锁定操作也可以被 fclose() 释放... 阅读全文
posted @ 2014-06-19 22:33 timily 阅读(298) 评论(0) 推荐(0)
摘要:非匹配用(?!exp) 匹配非“非内容”的表达式应该写成:^(?!.*非内容).*$1.正则中除非在方括号表达式之中[^]表示不接受该字符集合,否则^表示匹配输入字符的开始位置。2.例如:^(?!.*(帝国|法轮)).*$ 其中 .* 表示任意字符(除换行符)出现0次或多次3.常用分组语法 捕获 ... 阅读全文
posted @ 2014-06-19 22:28 timily 阅读(226) 评论(0) 推荐(0)
摘要:PHP程序使用mail()函数发送邮件的时候,标题中文的话会出现乱码。解决方法:先用函数base64_encode() ― 使用 MIME base64 对数据进行编码标题字符串前加编码类型例如: =?UTF-8?B?标题字符串后加:?=邮件header说明Content-type ― 防止邮件正文也乱码如:$to = 'test@example.com'; $subject = "=?UTF-8?B?".base64_encode('邮件标题')."?="; $headers = 'MIME-Version: 1 阅读全文
posted @ 2014-03-31 11:38 timily 阅读(239) 评论(0) 推荐(0)