Mar172012
Mar172012
eclipse安装html javascript编辑器
1.在eclipse中选择 help->install new software.
2.在work with 框中输入:Indigo - http://download.eclipse.org/releases/indigo
3. Web, XML, Java EE and OSGi Enterprise Development 选项下选中要安装编辑器
如图:
注意:安装过程中可能出现错误,尽量少的选择保证成功的几率大,只安装需要的。
阅读全文
Mar172012
php中session过期时间设置及回收机制详解
php中session过期时间设置及回收机制详解:
修改php中的session过期时间可以修改php配置文件php.ini中的session.gc_maxlifetime即可。
当php每发出一次请求时,会有1/100的概率(默认值)触发"session回收"。如果"session回收"发生,那就会检查/tmp/sess_*的文件,如果最后的修改时间到现在超过了1440秒(gc_maxlifetime的值),就将其删除,意味着这些session过期失效。
1. sessio...阅读全文
Mar152012
Mar132012
php时间处理函数
php 时间一般都采用大整数的是形式存储和调用。 time() 函数返回当前时间的 Unix 时间戳。
<?php
$t=time();
$nextWeek = time() + (7 * 24 * 60 * 60); // 7 days; 24 hours; 60 mins; 60secs
echo $t;
echo $nextWeek;
?>
strtotime(time,now) 函数将任何英文文本的日期时间描述解析为 Unix 时间戳。
<?php
echo(strtotime("now"));
echo(strtotime("3 October 2005")...阅读全文
Mar092012
php __construct函数和构造函数分析
php4以前的版本中,类的构造函数即是类的同名函数,而到了php5类的构造函数多了一个__construct魔法函数,那当这两个同时存在时,构造实例时调用的到底是哪个函数呢?
1、两个函数都存在的情况下
Php代码
<?php
class A{
var $str = "construct";
function __construct(){
$this->str = "construct";
}
function A(){
$this->str = "A";
}
}
$a = new A()...阅读全文
Mar052012
php explode与split的区别
今天在使用split时遇到一些问题。还是对函数理解不深刻,特写出来做个记号。
首先来看下两个方法的定义:
函数原型:array split (string $pattern, string $string [, int $limit])
函数原型:array explode ( string $separator, string $string [, int $limit])
初看没有啥差别,貌似功能都一样。我就犯了这个错误。 请注意两个函数的第一个参数string $pattern和string sep...阅读全文
Mar022012
php exec用法详解
exec函数解析
exec语法: string exec(string command, string [array], int [return_var]);
exec返回值: 字符串
Exec参数说明
Command – 需要执行的命令
Array – 是输出值
return_var –是返回值0或1,如果返回0则执行成功,返回1则执行失败。
exec不成功,调试方案
一个技巧就是使用管道命令, 使用 2>&1, 命令就会输出shell执行时的错误到$output变量, 输出该变量即可分析...阅读全文
Mar022012
mysql添加列,删除列,修改表名,列名,列类型
alter table test rename test1; --修改表名
alter table test add column name varchar(10) not null; --添加表列
alter table test drop column name; --删除表列
alter table test modify address char(10) not null;--修改列类型
alter table test change column address address1 char(40) not null;--修改列名称和类型阅读全文
Mar012012
php下eclipse 用空格替换 tab键
本人用eclipse进行PHP项目开发,根据公司开发规范,要用4个空格替换掉tab键,详细的配置如下:
1. windows=》preferences=》general=》editors=》text editors 勾选 “insert spaces for tabs”
2. windows=》preferences=》phpeclipse=》php=》typing 勾选 “insert spaces for tabs(……)”
至此,配置完毕。
但是因为版本的不同,有些会出现这样的问题:if{ ...阅读全文