
php
文章平均质量分 55
CodeMasterShiller
一个老码农
展开
-
php 回调函数
C / C++传递回调函数时,一般是传一个函数指针,而php比较有意思,传函数名的字符串就行。function add($a, $b){ return $a + $b;}function test($func, $a, $b){ if (function_exists($func) echo $func($a, $b); else echo "bad fu原创 2010-04-07 19:21:00 · 465 阅读 · 0 评论 -
Seven habits for writing secure PHP applications
from http://www.ibm.com/developerworks/opensource/library/os-php-secure-apps/index.htmlWhen it comes to security, remember that in add转载 2011-09-16 21:56:44 · 2128 阅读 · 0 评论 -
一个php session 实现的问题
<br />php可以通过session_set_save_handler函数设置回调,通过应用层来实现session数据的存储和管理。<br /> <br />使用此函数时,有一点需要注意,设置的钩子函数并不是一次设置,一直有效。在请求结束或者调用session_destroy时,保存的回调函数指针也将被清除,下次再使用时须重新设置。<br /> <br />不知为何原因php不将回调钩子函数的生命周期设计为跨请求的。原创 2011-04-15 22:34:00 · 798 阅读 · 0 评论 -
php的max-execution-time参数
<br />linux的php最大执行时间是使用setitimer的ITIMER_PROF类型,触发SIGPROF信号。统计的是一个php请求的cpu消耗时间,如果请求处于sleep状态,是不计时间的。如果在php-cgi个数有限,而请求中阻塞睡眠函数较多的情况下,可以将timer类型改为ITIMER_REAL类型<br /> <br />另外,php.ini中的max-execution-time参数对php-cli是无效的,只对php-cgi有效。原创 2011-03-21 09:43:00 · 1418 阅读 · 0 评论 -
php的strlen函数的时间复杂度
<br />php的strlen函数时间复杂度是O(1)的,从下面php的源码中可以看出来。 zend_builtin_functions.cZEND_NAMED_FUNCTION(zend_if_strlen){ zval **str; if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) { ZEND_WRONG_PARAM_COUNT();原创 2011-01-29 03:42:00 · 2732 阅读 · 0 评论 -
explode和split的区别
<br />简述<br />explode用字符串分割,split用正则分割,explode快多了<br />php文档还说preg_split比split快,所以永远不要用splithttp://blog.brianhartsock.com/2007/06/11/php-explode-vs-split/PHP: explode() vs. split()<br />Even though I have been a PHP programmer for 4 years or so now, I stil原创 2011-01-27 18:39:00 · 4404 阅读 · 1 评论 -
php使用curl上传文件
<br />http://dtbaker.com.au/random-bits/uploading-a-file-using-curl-in-php.htmlUploading a file using Curl in PHP<br />Here's how to upload files using curl in php: (it's very easy)<br />notice the @ infront of the file path, this is the magic part.<?php<b转载 2010-12-17 23:32:00 · 1043 阅读 · 0 评论 -
php拓展开发-处理可变个数的参数
http://theserverpages.com/php/manual/en/zend.arguments.variable.phpDealing with a Variable Number of Arguments/Optional Parameters If your function is meant to accept a variable number of arguments, the snippets just described are sometimes suboptimal so转载 2010-12-03 09:13:00 · 955 阅读 · 0 评论 -
php拓展开发-教程
<br />http://docstore.mik.ua/orelly/webprog/php/ch14_01.htm转载 2010-12-03 09:19:00 · 491 阅读 · 0 评论 -
新浪云计算平台应用开发
<br /><br />Linux下SAE开发流程<br /> <br />简介<br />http://wiki.sae.sina.com.cn/doku.php?id=faq<br />SAE是Sina App Engine(新浪应用引擎)的缩写,SAE是一个分布式web应用开发运行的服务平台,其不仅仅包含创建、部署web应用的简单交互,更涉及一整套大规模分布式服务的解决方案。用户通过SAE可以方便的创建web应用、定制web应用、开发web应用、部署web应用、切换线上版本、删除应用,大大节省了开发者原创 2010-07-03 08:39:00 · 1192 阅读 · 0 评论 -
mantis附件图片预览
为mantis系统bug查看页面附件图片预览添加显示隐藏按钮原创 2010-07-01 20:52:00 · 3165 阅读 · 0 评论 -
mantis的多语言支持特性分析
通过设置(在config_inc.php中设置$g_default_language = {lang})使得mantis系统自动加载lang目录下的strings_{lang}.txt文件,将很多$s_{word_id}类型的变量载入。然后,在显示的时候通过lang_get({word_id})获取。从而达到支持多语言的目的。原创 2010-07-01 20:12:00 · 1998 阅读 · 0 评论 -
php session实现原理
<br />from http://163navy.blog.163.com/blog/static/105304086200971732736207/php session实现原理<br />PHP & Person 2009-08-17 15:27:36 阅读268 评论0字号:大中小<br /> <br />SESSION的实现中采用COOKIE技术,SESSION会在客户端保存一个包含session_id(SESSION编号)的COOKIE;在服务器端保存其他session变量,比如session_转载 2010-07-01 21:07:00 · 639 阅读 · 0 评论 -
php设置session永不过期
url:http://www.phpiask.com/?p=157让PHP的session永不过期,你可能没有遇到这么郁闷的问题,但是我遇到过,很郁闷。我们前期开发了一个只有公司客服人员才能使用的系统——有限的几个客服人员。就是这有限的几个客服人员前几天突然就提出这样的问题:我们每隔很短一段时间(半个小时不操作页面),正着急解决客户问题的时候,系统却提示需要登录,耽误了客户的时间……这很转载 2010-04-07 19:48:00 · 2885 阅读 · 0 评论 -
页面访问计数代码
$shm_id = @shmop_open(0xff3, "w", 0644, 4);if (!$shm_id){echo "create counter!/n";$shm_id = @shmop_open(0xff3, "c", 0644, 4);if (!$shm_id){echo "shmop_open error!/n";exit;}}原创 2010-04-07 19:42:00 · 545 阅读 · 0 评论 -
php调用系统API
w32api_register_function,相当于LoadLibrary和GetProcAddress的合并体。// Define constants needed, taken from// Visual Studio/Tools/Winapi/WIN32API.txtdefine("MB_OK", 0);// Load the extension indl("php_w3转载 2010-04-07 19:22:00 · 3147 阅读 · 0 评论 -
php如何匹配反斜杠
from http://www.developwebsites.net/match-backslash-preg_match-php/What is preg_match()?The preg_match() function will perform a Per转载 2011-08-20 09:55:39 · 2522 阅读 · 0 评论